![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Location: Melbourne, Victoria
Posts: 10
|
e.g. A1 - data entry, B1 - VLOOKUP function, C1 - VLOOKUP function, where B1 and C1 look up A1.
When A1 is blank, B1 and C1 display #VALUE (or something to that effect). When A1 is blank I want them to be blank. I put in an IF statement - IF(,(VLOOKUP(A1,'Table!A9:B20',2,0),"") What do I put in as the first variable of the IF statement. Or are there some other ideas? Please help! |
|
|
|
|
|
#2 | |
|
Board Regular
Join Date: Feb 2002
Location: Houston,Texas
Posts: 418
|
Quote:
|
|
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
|
Hi Danielle:
If your lookup value is in cell A1, your lookup range is A9:B20, you are looking up the value in column 2, you want an exact match ... and if A1 is blank you want the looked up value (say in cell B1) to be also blank, then your formula in cell B1 should be: =if(A1="","",vlookup(A1,$A9:$B20,2,0)) I hope this is what you want ... please post if it works for you, otherwise explain a little further what you are trying to acomplish!
__________________
Regards! Yogi Anand, D.Eng, P.E. Energy Efficient Building Network LLC www.energyefficientbuild.com |
|
|
|
|
|
#4 |
|
New Member
Join Date: Mar 2002
Location: Melbourne, Victoria
Posts: 10
|
The above doesn't work. Can anyone else help?
The problem is explained in the first post but if you've missed it: A1 - Normal data, B1 - VLOOKUP function, C1 - VLOOKUP function, where B1 & C1 look up A1. When A1 is blank, B1 and C1 show #VALUE. What I want is an IF statement so that when A1 is blank, so are B1 and C1. Can anyone help? |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Location: Ireland
Posts: 133
|
Yogi answered your query above. That should work. What you need to do is put =if(a1="","",VLOOKUP(A1,'Table!A9:B20',2,0)) in cell B1 & C1. This way if A1 is blank, it doesn't even look at the VLOOKUP function. I hope this works... be sure to let us know!
|
|
|
|
|
|
#6 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
=LEN(A1) while VLOOKUP ends up in a #VALUE! error? |
|
|
|
|
|
|
#7 |
|
New Member
Join Date: Mar 2002
Location: Melbourne, Victoria
Posts: 10
|
When I typed in what everyone suggested it didn't work so I tried to do it through the Function Wizard and for some weird reason it worked. This is the statement I ended up with.
=IF(C21>"",VLOOKUP(C21,'Lookup Table'!A10:B24,2,0),"") Go figure!! Thanks for everyone's help |
|
|
|
|
|
#8 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
The formula Anand suggested should work. By the way, I asked applying LEN to see whether you had a space instead of a blank in the cell from where you pick up the lookup value. Aladin |
|
|
|
|
|
|
#9 |
|
New Member
Join Date: Mar 2002
Location: Melbourne, Victoria
Posts: 10
|
I didn't try LEN because I don't know what it is and by that time my IF statement worked.
By function wizard I mean: Insert --> Function --> Logical, IF --> OK --> then I basically filled in the blanks. I don't understand why when I type in the exact same formula it doesn't work! |
|
|
|
|
|
#10 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
Aladin |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|