+ Reply to Thread
Results 1 to 10 of 10

sum of multiple Vlookups...

  1. #1
    Registered User
    Join Date
    07-24-2010
    Location
    california
    MS-Off Ver
    Excel 2010
    Posts
    4

    sum of multiple Vlookups...

    Listed are the two tables that I am trying to join using a Vlookup. However, I was wondering if there was a better way to possibly get the same result using array functions in Excel.

    Name Item-1 Item-2 Item-3 Item-4 Vlookup-Item-1 Vlookup-Item-2 Vlookup-Item-3 Vlookup-Item-4 Total
    a 1 3 5 7 5 12 22 22 61
    b 2 4 6 7 17 27 51
    c 1 5 5 22 27
    d 2 4 8 7 17 17 41


    Item Price
    1 5
    2 7
    3 12
    4 17
    5 22
    6 27
    7 22
    8 17


    I want to end up with the Total column without having to do all the different Vlookup's (Vlookup-Item-1 thru Vlookup-Item-4) and summing up the result.

    Vlookup is "IF(B2>0,VLOOKUP(B2,$A$10:$B$17,2,FALSE),"")"



    Any insight would be greatly appreciated.

    Sudheer

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    re: sum of multiple Vlookups...

    just add the sum ifs together
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    re: sum of multiple Vlookups...

    Using Martin's file - you could use a construct along the lines of:

    =SUMPRODUCT(SUMIF($A$10:$A$17,$B1:$E1,$B$10:$B$17))
    copied down

  4. #4
    Registered User
    Join Date
    07-24-2010
    Location
    california
    MS-Off Ver
    Excel 2010
    Posts
    4

    re: sum of multiple Vlookups...

    Thank you Martin & DonkeyOte:

    Only problem with your solution is it fails to error out if there is an entry in Column B through E of table-1 without an entry in table-2. Try deleting ITEM 4 from table 4. How do we handle such exceptions?

    I also have reservations using Martin's solution in this particular problem because in the real world I have to work with 12 columns from table-1 (as opposed to 4 in this example) and the formula gets a little unwieldy.

    Once again, thanks for all your help!

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    re: sum of multiple Vlookups...

    Table 4 ?

    If there is no value in the "lookup table" for a given item then the SUMIF will return 0 for that particular item - what were you expecting to happen exactly ?

    Perhaps best to post a sample file.

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    re: sum of multiple Vlookups...

    this is what happens when you don't give a realistic example!

  7. #7
    Registered User
    Join Date
    07-24-2010
    Location
    california
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: sum of multiple Vlookups...

    I am sorry about not being clear. Attached is the sample sheet with the various options. What I am looking to get is the result in the "Total" column. All the options included give the correct result as far as every item listed in column B through E in table-1 has a corresponding entry in Table-2.

    Try deleting the row corresponding to item-4 in table-2. The "Total" column displays "#NA" indicating an error, whereas option-1 through ignore the missing entry from table-2.

    In such situations, I would like to be notified about the missing entry.

    I hope I was clear. Thank you all for your help.
    Attached Files Attached Files

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: sum of multiple Vlookups...

    you could simply use conditional formatting to highlight any item missing from list in c:a11:a20
    i added 0 as blanks =0 and you'd get highlighted cells all over the place.
    now try deleting item 4
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    07-24-2010
    Location
    california
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: sum of multiple Vlookups...

    Hi Martin:

    Thx for that solution. However, given that there may be 1000's of rows involved and several different tabs, I still have to look for a solution that would result in a severe error in calculation thereby alerting the necessary party.

    I truly appreciate your help.

    Thx
    Sudheer

  10. #10
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: sum of multiple Vlookups...

    Using your sample file from post # 7 ... perhaps you want something like:

    Please Login or Register  to view this content.

+ 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