+ Reply to Thread
Results 1 to 4 of 4

VlookUp - Trying to sum results but have #N/A

  1. #1
    Registered User
    Join Date
    07-17-2009
    Location
    Paris
    MS-Off Ver
    Excel 2003
    Posts
    28

    VlookUp - Trying to sum results but have #N/A

    Hi,
    I have Vlookup Statement, which works fine.
    I am trying to sum up the results of my Vlookup, but some results return a correct #N/A when the data is not found.
    What is the best way to work around this issues?
    Last edited by jpnyc; 05-06-2010 at 11:32 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VlookUp - Trying to sum results but have #N/A

    In Excel 2003, there's no choice but to test the data for a match first, it's basically double-dinging but what can you do?

    =VLOOKUP(A1, B:C, 2, 0)

    Could become:

    =IF(ISERROR(VLOOKUP(A1, B:C, 2, 0)), "", VLOOKUP(A1, B:C, 2, 0))
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: VlookUp - Trying to sum results but have #N/A

    I agree with Jbeaucaire on the returning of either blank or zero if there is no match in the VLOOKUP. However, in order to prevent double lookups as is done in nesting VLOOKUP in the IF Function, it could be more efficient to use a helper column to reference the result cell and then do the sum on the helper column.

    Helper cell formula: = IF(ISNA(A1),0,A1)
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

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

    Re: VlookUp - Trying to sum results but have #N/A

    If there's only one match you could use a SUMIF rather than a VLOOKUP - two birds etc...

    The other alternative to "double dinging" using a VLOOKUP would be:

    =LOOKUP(9.99E+307,CHOOSE({1,2},0,VLOOKUP(A1,B:C,2,0)))

    the VLOOKUP is only evaluated once - 0 returned if no match found.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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