Return 0 instead of #n/a

B

Brian

I'm using some vlookup formulas to verify dates, and I want to get a "0"
response for dates that are not in my lookup list rather than "#n/a".
Any suggestions on a formula?
I tried =if(vlookup(date,A1:A500,1,0)=1,1,0)
However this still giving me a #n/a answer.

Thanks
 
D

Dave Peterson

It's looking like you're returning a 1 if the date is found in that range.

You could use:
=--(isnumber(match(yourdate,a1:a500,0)))

=match() returns the number of the row in the range that matches (if there's a
match). Otherwise, it returns an error.

=isnumber() returns true or false

and the -- stuff converts those False's to 0's and the True's to 1.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top