+ Reply to Thread
Results 1 to 2 of 2

Using vlookup but returning a zero value if nothing found

  1. #1
    Registered User
    Join Date
    02-01-2008
    Posts
    1

    Using vlookup but returning a zero value if nothing found

    I wonder if someone could help me, I am using a VLOOKUP function to find a number / value in a pivot table and return that value in the cell. However I want it to return 0 (zero) if there is no number / value in the table.
    I have in the past used COUNTIF function and it has worked but now it keeps giving me a #VALUE! - i have tried changing the formats so that all text is TEXT and all numbers are NUMBERS etc. but this doesnt seem to correct the problem.
    I think it is something simple but for the life of me cant work out what it is!!


    This is the formula I am using, column A is a code (in TEXT) and B is a total in stock.
    =IF(COUNTIF(Pivot!$A$1:$B$5,A1),VLOOKUP(Pivot!$A$1:$B$5,A1,2,FALSE),0)

    I would appreciate any help.

    Thanks in advance


    Neil

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,743
    Try

    =IF(COUNTIF(Pivot!$A$1:$A$5,A1),VLOOKUP(A1, Pivot!$A$1:$B$5,2,FALSE),0)

+ 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