How to set a vlookup with missing numbers

SugarCube

New Member
Joined
Aug 8, 2018
Messages
2
I have a spreadsheet that lists all of the items I need to order. They are in numerical order but some items are not needed so they are not in the range for the vlookup (picture 1). #1051 is missing. Since #1051 is missing, it duplicates the amount in #1050 (picture 2). I get that it has no info to pull from for #1051 - I need to see how to make #1051 show as 0. I have tried to google some info, maybe adding a CountIf or some other function but I can't figure it out. Any help is appreciated! (New to this site. Hoping pictures attached :confused: )
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Welcome to the Board!

It sounds like you have the last argument of your VLOOKUP set to TRUE, which tells Excel that if it cannot find a match, select the value from the closest one less than that.
If you set that argument to FALSE, it with return a #N/A error, indicating no match. If you surround that in an IFERROR statement, you can tell it to return 0 instead of that error code, i.e.
Code:
=IFERROR(VLOOKUP([I]arg1,arg2,arg3[/I],FALSE),0)
 
Upvote 0
Thank you Joe4!!! Actually I didn't have it as True or False. I did have the IfError already in there and couldn't see why it wasn't giving me a 0. I updated the formula to False and BAM! It worked!!! Thank you!!
 
Upvote 0
Actually I didn't have it as True or False.
Yep, if you omit that 4th argument, it defaults to TRUE. You need to explicitly enter a FALSE (or 0) if you want it to be false.

Glad it worked for you! :)
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,269
Members
452,628
Latest member
dd2

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