Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 199
  • Last Modified:

if with vlookup tricky or alternative solution

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
route217
Asked:
route217
  • 5
  • 4
  • 3
2 Solutions
 
NBVCCommented:
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
 
route217Author Commented:
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
 
NBVCCommented:
Try:

=IF(A2="",IF(B2="","",B2),VLOOKUP(A2,Sheet2!$A$2:$F$15,2,FALSE))
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Rob HensonIT & Database AssistantCommented:
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
 
route217Author Commented:
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
 
NBVCCommented:
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
 
Rob HensonIT & Database AssistantCommented:
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
 
route217Author Commented:
Hi all

Formula in cell b2 and the look up table is if a2 has text and b2 is blank.m
0
 
route217Author Commented:
Hi experts....

Got it to work..realised my mistake. .

Appreciate the excellent feedback.
0
 
Rob HensonIT & Database AssistantCommented:
Do you mind sharing what the mistake was? We may still be able to help/improve.

Rob
0
 
route217Author Commented:
Hi rob

I stuck the formula in the wrong cell...circular ref.
0
 
NBVCCommented:
.
.
.
.
.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 5
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now