Skip to content

Instantly share code, notes, and snippets.

@BDollar
Created May 29, 2013 12:45
Show Gist options
  • Save BDollar/5670015 to your computer and use it in GitHub Desktop.
Save BDollar/5670015 to your computer and use it in GitHub Desktop.
Excel formula for subdividing a string in a cell and looking up the sections of the string in other worksheets.
'ItemNumber', 'Prefix' and 'Suffix' are named ranges.
=LEFT(C37,SEARCH(",",C37,1))&" "&VLOOKUP(LEFT(B37,SEARCH("-",B37,1)-1),Prefix,2,FALSE)&" x "&VLOOKUP(MID(B37,SEARCH("-",B37,1)+1,100),Suffix,2,FALSE)&" / "&VLOOKUP(LEFT(B37,SEARCH("-",B37,1)-1),Prefix,3,FALSE)&" x "&VLOOKUP(MID(B37,SEARCH("-",B37,1)+1,100),Suffix,3,FALSE)
=LEFT(C37,SEARCH(",",C37,1))&" "&VLOOKUP(LEFT(B37,SEARCH("-",B37,1)-1),Prefix,2,FALSE)&" x "&VLOOKUP(MID(B37,SEARCH("-",B37,1)+1,100),Suffix,2,FALSE)&" / "&VLOOKUP(LEFT(B37,SEARCH("-",B37,1)-1),Prefix,3,FALSE)&" x "&VLOOKUP(MID(B37,SEARCH("-",B37,1)+1,100),Suffix,3,FALSE)
=C366&" "&VLOOKUP(LEFT(MID(ItemNumber,SEARCH("-",ItemNumber)+1,100),SEARCH("-",MID(ItemNumber,SEARCH("-",ItemNumber)+1,100))-1),Prefix,2,FALSE)&" x "&VLOOKUP(MID(MID(ItemNumber,SEARCH("-",ItemNumber)+1,100),SEARCH("-",MID(ItemNumber,SEARCH("-",ItemNumber)+1,100))+1,100),Suffix,2,FALSE)&" / "&VLOOKUP(LEFT(MID(ItemNumber,SEARCH("-",ItemNumber)+1,100),SEARCH("-",MID(ItemNumber,SEARCH("-",ItemNumber)+1,100))-1),Prefix,3,FALSE)&" x "&VLOOKUP(MID(MID(ItemNumber,SEARCH("-",ItemNumber)+1,100),SEARCH("-",MID(ItemNumber,SEARCH("-",ItemNumber)+1,100))+1,100),Suffix,3,FALSE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment