Nested IF Statement using LEN

rplohocky

Active Member
Joined
Sep 25, 2005
Messages
292
Office Version
  1. 365
Platform
  1. Windows
Hello,
I found this formula online which returns a blank cell if the VLOOKUP doesn't find anything in the 3rd column instead of ZERO.
<code>
=IF(LEN(VLOOKUP(A1,Sheet1!$1:$1048576,3,FALSE))=0,"",VLOOKUP(A1,Sheet1!$1:$1048576,3,FALSE))
</code>
The formula works great but need to add an additional argument. I would like to add
<code>
IF A1 is greater than blank then VLOOKUP(A1,Sheet1!$1:$1048576,3,FALSE
</code>

Can anyone help?
 
Sorry during testing took out one section try this instead:

Code:
=IF(OR(ISBLANK(A1),(ISNA(VLOOKUP(A1,Sheet1!1:1048576,3,FALSE)))),"",IF(VLOOKUP(A1,Sheet1!1:1048576,3,FALSE)="","",VLOOKUP(A1,Sheet1!1:1048576,3,FALSE)))

philwojo,
You are so close! Here's what's happening.
It works for the most part.
1. It doesn't bring back zero or #N/A. GOOD!
2. It brings back numbers if they are found. GOOD!
3. It brings back combinations such as number mixed with letters, regardless if they start with a number or letter. GOOD!
4. It WON'T bring back letters by themselves such as an email address. BAD

I can't figure out why it won't return letters but this will have to be looked at because one of my VLOOKUPS needs to return email addresses.

You are so close!!!
 
Upvote 0

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.
The formula, as it works for me and brings back letters or numbers or emails, mine is not working as yours is.

I'm not sure why it would do that, maybe someone else has an idea.
 
Upvote 0
philwojo,
You are so close! Here's what's happening.
It works for the most part.
1. It doesn't bring back zero or #N/A. GOOD!
2. It brings back numbers if they are found. GOOD!
3. It brings back combinations such as number mixed with letters, regardless if they start with a number or letter. GOOD!
4. It WON'T bring back letters by themselves such as an email address. BAD

I can't figure out why it won't return letters but this will have to be looked at because one of my VLOOKUPS needs to return email addresses.

You are so close!!!

Small update for you.
If you are looking up letters in the VLOOKUP it will then return letters. Weird!!!
 
Upvote 0
Again, mine does not function that way, what version of Excel are you using, maybe that has something to do with it, but the vlookup function, as far as I know, does not restrict what it will return, regardless of what is looked up.

I am headed home for the night, probably won't be checking this any more until next week, sorry.
 
Upvote 0
Small update for you.
If you are looking up letters in the VLOOKUP it will then return letters. Weird!!!

philwojo,
Please let me retract the last post. I had multiples of the same number in the search column. When i made the search column have unique numbers your formula worked great! Sorry for the issue.

Thanks for your help! I believe this formula will do the trick!
 
Upvote 0
No problem, glad to help and hope it is what you need, if not post back and someone from this community will help I'm sure, great people here.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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