+ Reply to Thread
Results 1 to 12 of 12

SUM of multiple VLOOKUPS

  1. #1
    Registered User
    Join Date
    12-09-2013
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 1997
    Posts
    8

    SUM of multiple VLOOKUPS

    I am trying to complete an Excel Document which is calculating my employees stats for me. I have 6 tabs. MTD (month to date), week 1, week 2, week 3, week 4, and week 5. On the MTD I am trying to subtotal each stats category (and there are several categories). I have about 80 employees. Each week I have defined as "stats_1", "stats_2", etc.

    So... on my MTD I am now trying to do a subtotal summing up each category from each week for each rep. Currently, I have -

    =SUM((VLOOKUP(A3,stats_1,2,FALSE)),(VLOOKUP(A3,stats_2,2,FALSE)),(VLOOKUP(A3,stats_3,2,FALSE)),(VLOOKUP(A3,stats_4,2,FALSE)),(VLOOKUP(A3,stats_5,2,FALSE)))

    I have also tried -

    =(VLOOKUP(A3,stats_1,2,FALSE))+(VLOOKUP(A3,stats_2,2,FALSE))+(VLOOKUP(A3,stats_3,2,FALSE))+(VLOOKUP(A3,stats_4,2,FALSE))+(VLOOKUP(A3,stats_5,2,FALSE))

    Currently, on week 2,3,4 and 5 there is no data entered b/c it hasn't gotten here yet - so right now they are blank...

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM of multiple VLOOKUPS

    Hi and welcome to the forum!

    You haven't said what's actually wrong with your current formula - is it just that if there's no data present in one or more of the VLOOKUPS then you need to account for the error(s), i.e.exclude it/them from the sum?

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    12-09-2013
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 1997
    Posts
    8

    Re: SUM of multiple VLOOKUPS

    My bad sorry - It is coming back saying #VALUE!

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM of multiple VLOOKUPS

    And are you sure that the results of all five LOOKUPS currently return a numerical value? (Be sure to double-check: some values can look like numbers but if the cell format is set to e.g. text then Excel will not interpret them as such.)

    Otherwise, it may be necessary for you to upload a workbook to determine where the issue lies.

    Regards

  5. #5
    Registered User
    Join Date
    12-09-2013
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 1997
    Posts
    8

    Re: SUM of multiple VLOOKUPS

    Well on the week 1, week 2, etc. tabs it's actually feeding off raw data from a different tab that I just paste. So if nothing is pasted for that week it normally would say #N/A, but I already have a formula to change the #N/A into a text of "N/A" I have also tried it as "0" or just blank "" - still nothing

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM of multiple VLOOKUPS

    But of course - Excel cannot add numbers to text values!

    So to go back to my original question: you basically want to exclude #N/A errors (i.e. when one or more of the VLOOKUPs does not return a match) from the sum, correct?

    Regards

  7. #7
    Registered User
    Join Date
    12-09-2013
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 1997
    Posts
    8

    Re: SUM of multiple VLOOKUPS

    Yes, that is correct

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM of multiple VLOOKUPS

    Ok. You can either add these error traps to your current formula:

    =SUM(IF(ISNA(VLOOKUP(A3,stats_1,2,FALSE)),0,VLOOKUP(A3,stats_1,2,FALSE)),IF(ISNA(VLOOKUP(A3,stats_2,2,FALSE)),0,VLOOKUP(A3,stats_2,2,FALSE)),IF(ISNA(VLOOKUP(A3,stats_3,2,FALSE)),0,VLOOKUP(A3,stats_3,2,FALSE)),IF(ISNA(VLOOKUP(A3,stats_4,2,FALSE)),0,VLOOKUP(A3,stats_4,2,FALSE)),IF(ISNA(VLOOKUP(A3,stats_5,2,FALSE)),0,VLOOKUP(A3,stats_5,2,FALSE)))

    Or, if you're interested, try this array** formula (though without seeing your actual sheet I can't be sure):

    =SUM(IF(T(OFFSET(INDIRECT("stats_"&ROW($1:$5)),TRANSPOSE(ROW(INDIRECT("1:100"))),,,))=$A$3,N(OFFSET(INDIRECT("stats_"&ROW($1:$5)),TRANSPOSE(ROW(INDIRECT("1:100"))),1,,))))

    The 100 will need to be changed to a number which is equal to or greater than the maximum number of rows in all five of your lookup ranges.

    Regards


    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).

  9. #9
    Registered User
    Join Date
    12-09-2013
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 1997
    Posts
    8

    Re: SUM of multiple VLOOKUPS

    Perfect thank you!!!!! Now, what about average? Would I just replace the word SUM w/ AVERAGE?

  10. #10
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM of multiple VLOOKUPS

    You're welcome!

    And that depends - if you do that straight replacement, then yes, you will have an average. But it will still be over five data points, even if only three, say, of the VLOOKUPs return a match.

    That's because the formulas are set to return a zero in those cases, so you'd still have, e.g.:

    =AVERAGE(1,2,3,0,0)

    which is (1+2+3+0+0)/5 = 1.2

    whereas you might actually just want:

    (1+2+3)/3 = 2

    Can you clarify?

    Regards
    Last edited by XOR LX; 12-09-2013 at 03:32 PM.

  11. #11
    Registered User
    Join Date
    12-09-2013
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 1997
    Posts
    8

    Re: SUM of multiple VLOOKUPS

    Yes, the second one. I want to omit any 0's or anything that does not have a value.

  12. #12
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM of multiple VLOOKUPS

    Then (with thanks to Tony Valko ):

    =AVERAGE(IF(ISNA(VLOOKUP(A3,stats_1,2,FALSE)),{""},VLOOKUP(A3,stats_1,2,FALSE)),IF(ISNA(VLOOKUP(A3,stats_2,2,FALSE)),{""},VLOOKUP(A3,stats_2,2,FALSE)),IF(ISNA(VLOOKUP(A3,stats_3,2,FALSE)),{""},VLOOKUP(A3,stats_3,2,FALSE)),IF(ISNA(VLOOKUP(A3,stats_4,2,FALSE)),{""},VLOOKUP(A3,stats_4,2,FALSE)),IF(ISNA(VLOOKUP(A3,stats_5,2,FALSE)),{""},VLOOKUP(A3,stats_5,2,FALSE)))

    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Multiple vlookups?
    By dominoes in forum Excel General
    Replies: 4
    Last Post: 07-20-2012, 08:55 PM
  2. Are Multiple VLookups possible?
    By D4WNO77 in forum Excel General
    Replies: 1
    Last Post: 01-05-2012, 10:44 AM
  3. VLOOKUPS in multiple closed workbooks with multiple tabs
    By exclusivelyexcel in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-23-2011, 03:33 PM
  4. Excel 2007 : Multiple Vlookups
    By inquizitiv in forum Excel General
    Replies: 15
    Last Post: 10-26-2011, 03:22 PM
  5. multiple vlookups - what else?
    By lennyphil in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-13-2009, 08:52 PM

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