+ Reply to Thread
Results 1 to 9 of 9

Multiple vlookup "lookup values" in a single cell?

  1. #1
    Registered User
    Join Date
    05-19-2010
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2003
    Posts
    16

    Multiple vlookup "lookup values" in a single cell?

    Is there a way to put multiple vlookup lookup values in one cell and have the result of multiple vlookups appear in one cell? For instance, I have this table:

    Code Amount
    A 5
    B 6
    C 8
    D 9

    I have a cell that contains "A, B, C"

    I want the vlookup to reference the cell that says "A, B, C" and return the sum of the values for A, B, & C, in this case, 19.

    I previously did multiple vlookups in one cell with a + operator between them, and had A, B, and C each in a separate cell.

    Is there any way to put multiple values in one cell and have the vlookup sum them automatically? They don't have to be comma separated, if that makes a difference. But they will be varying groups of text with a varying number of characters.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Multiple vlookup "lookup values" in a single cell?

    You can use =SUMIF(A:A, "A", B:B)+SUMIF(A:A, "B", B:B)+SUMIF(A:A, "C", B:B)

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Multiple vlookup "lookup values" in a single cell?

    Assuming your table is in A1:B5 and your concatenated lookup string is in F1, then try:

    =SUMPRODUCT(--(ISNUMBER(SEARCH($A$1:$A$4,F1))),$B$1:$B$4)

    Note: This will not accomodate duplicate characters in F1.... if you need that look into Colin's suggestion below
    Last edited by NBVC; 02-10-2011 at 11:42 AM. Reason: added another option
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,255

    Re: Multiple vlookup "lookup values" in a single cell?

    Yes, it's possible. It would be much easier (formula-wise and for maintenace) if you were prepared to separate out the A B C into separate cells though?

    Suppose your code/amount table is A1:B5 and F2:F4 contains the letters A B and C. To get 19 you could then use this formula:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Hope that helps,

    Colin

    RAD Excel Blog

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Multiple vlookup "lookup values" in a single cell?

    or another way, again if F1 contains the comma-delimited string:

    =SUMPRODUCT(SUMIF($A$1:$A$4,MID(SUBSTITUTE(F1,",",""),ROW(INDIRECT("1:"&LEN(SUBSTITUTE(F1,",","")))) ,1),$B$1:$B$4))

  6. #6
    Registered User
    Join Date
    05-19-2010
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Multiple vlookup "lookup values" in a single cell?

    Thanks all for the quick replies!

    zbor- this works but is inefficient because my data is not as simple as the example. The values in the cell will change and I don't want to retype the lookup values for each instance that I want to use the formula.

    Colin- thanks, I really wanted to keep all the criteria to one cell for the lookup by row... That said

    NVBC- this works well. Is there any way to accomodate additional columns of data? Let's say the values in column B have the header "Department 1" and there are more columns with different departments. Can this formula be modified so you expand the last range and specify a single header to sum? I hope my question makes sense.

    Thanks everyone!

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Multiple vlookup "lookup values" in a single cell?

    Yes you can.

    So assuming you now have row 1 headers, and so your data moves down 1 row.

    and assuming now the data covers A2:D5 with headers in B1:D1, and your search header value is in F1 and the search string in F2, then try:

    If you don't have duplicated search values..
    Please Login or Register  to view this content.
    If you do have duplicate search values...
    Please Login or Register  to view this content.
    I attached the last option sample...
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    12-14-2011
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    1

    Smile Re: Multiple vlookup "lookup values" in a single cell?

    Quote Originally Posted by NBVC View Post
    or another way, again if F1 contains the comma-delimited string:

    =SUMPRODUCT(SUMIF($A$1:$A$4,MID(SUBSTITUTE(F1,",",""),ROW(INDIRECT("1:"&LEN(SUBSTITUTE(F1,",","")))) ,1),$B$1:$B$4))

    highly grateful for giving this formula

  9. #9
    Registered User
    Join Date
    10-19-2015
    Location
    Brazil
    MS-Off Ver
    2016
    Posts
    1

    Re: Multiple vlookup "lookup values" in a single cell?

    Quote Originally Posted by NBVC View Post
    Yes you can.

    So assuming you now have row 1 headers, and so your data moves down 1 row.

    and assuming now the data covers A2:D5 with headers in B1:D1, and your search header value is in F1 and the search string in F2, then try:

    If you don't have duplicated search values..
    Please Login or Register  to view this content.
    If you do have duplicate search values...
    Please Login or Register  to view this content.
    I attached the last option sample...
    Hi,

    I know this is an old thread, but I just found it, and it almost helps me perfectly. However, my lookup values are numbers. With this attached sample numbers do not work. Does anybody know if there's another way?

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1