How can I replace #N/A with the value 0 using VLOOKUP

vidtec

New Member
Joined
Dec 31, 2005
Messages
8
I keep a complete inventory list in Excel XP (2002 ver), I have to include what our 40+ routes have on there trucks. They use computers to track there sales & inventory so I download there totals after they come in and upload there info. I querry a summery of there there inventorys and import it to a seperate sheet in the workbook. Then I use VLOOKUP to find the items and return the quanties to the inventory spreadsheet. If they don't have an item on there truck that we carry VLOOKUP returns a #N/A because it's not in the imported list and then that column will not add up. The numbers must be accurate so I have to use the false statment. Is there a way in the in the VLOOKUP formula to say if you can't find an item return a quanity of "0" instead of #N/A. The list is several hundred items long and changes daily I can't guarntee where in the imported data an item may or maynot be it has to search and look it up if it's there. The workaround I have been using is to manually find all the #N/A's and add them to the imported list and give them a quanity of "0" but this is time consuming and defeats the purpose of having the spreadsheet do the woke for you. Thank you for any help anyone may give. :biggrin:
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Sure, you can use an IF statement to do this:

Code:
=IF(ISNA(VLOOKUP(A1,DataRange,2,FALSE)),"",VLOOKUP(A1,DataRange,2,FALSE))

Modifying the VLOOKUP arguments as required.

Best regards

Richard


EDIT: this will show an empty string (ie "") if the lookup isn't matched. To result in a 0, just replace the "" with 0 in the above formula.
 
Upvote 0
...or
Code:
=IF(ISNA(VLOOKUP(A1,DataRange,2,FALSE)),0,VLOOKUP(A1,DataRange,2,FALSE))
if you want a zero instead of a blank.
 
Upvote 0
Thank You all very much this worked great. I tried the "IF" statement along with several others before but didn't have my I's dotted & T's crossed correctly. Works great now. This is a great message board can't wait for the book. :wink:
 
Upvote 0
Try this for your second problem.:
Book1
ABCD
1O.K.All I's are dottedAll t's are crossed
Sheet2


Formula in A1 is:
=IF(AND(B1="All i's are dotted",C1="All t's are crossed"),"O.K.","You forgot to dot your i's and cross your t's.")

:LOL: :LOL:
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top