Solved

if with vlookup tricky or alternative solution

Posted on 2014-03-19
12
190 Views
Last Modified: 2014-03-19
Hi Experts excel 2007

Need a formula to do the following. ..
If cell A2 is blank then leave the text currently in cell B2, otherwise if cell A2 has text,  then lookup answer from range A2:F15 sheet 2.
0
Comment
Question by:route217
  • 5
  • 4
  • 3
12 Comments
 
LVL 23

Assisted Solution

by:NBVC
NBVC earned 250 total points
ID: 39939315
Try:

=IF(A2="",B2,VLOOKUP(A2,Sheet2!$A$2:$F$15,2,FALSE))

where in the VLOOKUP you are looking for A2 value in column A of Sheet2, and then the 2 means you want to get the item from the 2nd column of range A2:F15
0
 

Author Comment

by:route217
ID: 39939328
NBVC

Firstly many thanks excellent feedback. .just need a slight addition to the above formula if a2 is blank and also b2 is blank then leave b2 as blank then apply above. .
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39939337
Try:

=IF(A2="",IF(B2="","",B2),VLOOKUP(A2,Sheet2!$A$2:$F$15,2,FALSE))
0
 
LVL 32

Accepted Solution

by:
Rob Henson earned 250 total points
ID: 39939368
Or you can use the AND function:

=IF(AND(A2="",B2=""),"",VLOOKUP(A2,Sheet2!$A$2:$F$15,2,FALSE))

Reading the question, it sounds like you want to put this formula in cell B2 but that will overwrite the contents of the cell, blank or otherwise. And referring to itself will create a circular reference.

Is that correct assumption?

Thanks
Rob H
0
 

Author Comment

by:route217
ID: 39939377
Hi expert's. ..

Apologies if I have made an error...
But if a2 is blank and b2 is blank then b2 is blank,  however if a2 is blank and b2 has text then b2 otherwise vlookup. .

I am getting blank when a2 is blank and b2 has text.
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39939388
As Rob said, if you are putting the formula in B2, you will get a circular reference error (a formula can't be used to check the cell it is in).  The formula needs to be put in another cell, like C2, then my formula will work.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 32

Expert Comment

by:Rob Henson
ID: 39939393
As I said in my comment, you cannot refer to a cell within a formula in that cell. You will get circular reference.

Where are you putting the formula?

What are you using as a lookup to find the answer from Sheet2?

Thanks
Rob H
0
 

Author Comment

by:route217
ID: 39939406
Hi all

Formula in cell b2 and the look up table is if a2 has text and b2 is blank.m
0
 

Author Comment

by:route217
ID: 39939415
Hi experts....

Got it to work..realised my mistake. .

Appreciate the excellent feedback.
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 39939419
Do you mind sharing what the mistake was? We may still be able to help/improve.

Rob
0
 

Author Comment

by:route217
ID: 39939458
Hi rob

I stuck the formula in the wrong cell...circular ref.
0
 
LVL 23

Expert Comment

by:NBVC
ID: 39939466
.
.
.
.
.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Copy value from a certain cell 5 24
Update As Well As Add 6 35
Excel Automation VBA 19 25
Pivot help - Display only Is Not Null 7 14
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now