View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
~L ~L is offline
external usenet poster
 
Posts: 177
Default Cell value with multiple values to vlookup

Find the first term in A2:
LEFT(A2,LEN(A2)-FIND(",",A2)-1)
This outputs as text.

Find the second term in A2:
RIGHT(A2,LEN(A2)-FIND(",",A2)-1)
This outputs as text too.

Sum the two (Which you can only do if they're numbers):
=LEFT(A2,LEN(A2)-FIND(",",A2)-1)+RIGHT(A2,LEN(A2)-FIND(",",A2)-1)
The outcome will be a number.

You mention a lookup, which leads me to believe that A2 contains two text
items that you need to look up values for in a table. If that's the case and
A2 actually contains "Cat, Dog" and you need to look up the value for Cat and
Dog in the table, then add those:

=VLOOKUP(LEFT(A2,LEN(A2)-FIND(",",A2)-1),ValueTableLocation,2,False)+VLOOKUP(RIGHT(A2,LE N(A2)-FIND(",",A2)-1),ValueTableLocation,2,False)

Hopefully something in there is useful to you.

"Matheus" wrote:

I have one spreadsheet with the a column with a location code and another
column with the number of employees (Colum A2:A200 are the codes and B2:B200
are the number of employees).

On another spreadsheet, some locations are combined into one sigle row. So I
have a cell with the location codes separated by a coma (example: A2 = 100,
200).

Is there a way for me to use a function on B2 similar to a vlookup that will
look both values from A2 and add them up?