Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Combining "IF"statement with "Vlookup"

13,898 views
Skip to first unread message

Malcolm McMaster

unread,
Apr 11, 2008, 7:11:01 PM4/11/08
to
I have a data table in a worksheet that uses the vlookup to match a unique
value from a cell and populate various other cells with data retreived.
The problem is that the formula is active and any blank lookup value returns
the usual #NA throughout the data sheet. I thought I might be able to combine
an "IF" cell is not empty then Vlookup.
Can any body help with this ? or another alternative

Thanks in advance.

Malcolm McMaster

mike

unread,
Apr 11, 2008, 7:15:00 PM4/11/08
to
Try:

=IF(A1="","",VLOOKUP(whatever you need to lookup))

Assuming A1 is the cell to recieve a value that will be looked up elsewhere.

Bob Phillips

unread,
Apr 11, 2008, 7:18:58 PM4/11/08
to
Just use

=IF(ISNA(vlookup_formula),"",vlookup_formula)

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Malcolm McMaster" <Malcolm...@discussions.microsoft.com> wrote in
message news:4EAB98C7-D701-468E...@microsoft.com...

Alan

unread,
Apr 11, 2008, 7:29:18 PM4/11/08
to
Not entirely sure I understand.
If you mean the cell that contains the value the VLOOKUP is searching for is
blank, in this example D2, then
=IF(D2<>"",VLOOKUP(D2,A1:B7,2,FALSE),"")
If you mean the cell in the data table the VLOOKUP finds is blank then,
=IF(ISNA(VLOOKUP(D2,A1:B8,2,FALSE)),"",VLOOKUP(D2,A1:B8,2,FALSE))
If your using 2007 I believe there is a function to do this easier, (I'm on
2003)
Regards,
Alan.

"Malcolm McMaster" <Malcolm...@discussions.microsoft.com> wrote in
message news:4EAB98C7-D701-468E...@microsoft.com...

mike

unread,
Apr 11, 2008, 7:40:01 PM4/11/08
to
In 2007 you could also use IFERROR(), which is what I think Alan is refering
to.

=IFERROR(VLOOKUP(),"")

Also, Alan is correct in that it depends on what it is that is left blank.
My original suggestion assumed that the entry cell is what is blank.

Nidhi

unread,
Sep 18, 2013, 11:40:17 AM9/18/13
to
On Saturday, April 12, 2008 2:40:01 AM UTC+3, mike wrote:
> In 2007 you could also use IFERROR(), which is what I think Alan is refering to.=IFERROR(VLOOKUP(),"")Also, Alan is correct in that it depends on what it is that is left blank. My original suggestion assumed that the entry cell is what is blank."Alan" wrote:> Not entirely sure I understand. > If you mean the cell that contains the value the VLOOKUP is searching for is > blank, in this example D2, then > =IF(D2<>"",VLOOKUP(D2,A1:B7,2,FALSE),"") > If you mean the cell in the data table the VLOOKUP finds is blank then, > =IF(ISNA(VLOOKUP(D2,A1:B8,2,FALSE)),"",VLOOKUP(D2,A1:B8,2,FALSE)) > If your using 2007 I believe there is a function to do this easier, (I'm on > 2003)> Regards,> Alan. > "Malcolm McMaster" <Malcolm...@discussions.microsoft.com> wrote in > message news:4EAB98C7-D701-468E...@microsoft.com... > >I have a data table in a worksheet that uses the vlookup to match a unique > > value from a cell and populate various other cells with data retreived. > > The problem is that the formula is active and any blank lookup value > > returns > > the usual #NA throughout the data sheet. I thought I might be able to > > combine> > an "IF" cell is not empty then Vlookup. > > Can any body help with this ? or another alternative> > > > Thanks in advance.> >> > Malcolm McMaster > >

Sir's, I have the same issue, but something more complicated for me. i have two sheets in a work book,
sheet1- Item, Brand, price.
Sheet2 -Item, Brand, empty price column.
How to run vlookup to match the 2 entities in sheet 2 and match with sheet 1 and pull the exact price? Please help me.

joeu2004

unread,
Sep 18, 2013, 2:09:36 PM9/18/13
to
"Nidhi" <nidhe...@gmail.com> wrote:
> i have two sheets in a work book,
> sheet1- Item, Brand, price.
> Sheet2 -Item, Brand, empty price column.
> How to run vlookup to match the 2 entities in sheet 2
> and match with sheet 1 and pull the exact price?

I don't see how this is related to the previous discussion or the quoted
response. And in any case, it would be better to submit a new question
instead of "responding" to a 5-year-old discussion.

Assuming that Item is in A2:A1000, Brand is in B2:B1000, and Price is in
C2:C1000, you might use the following array-entered formula (press
ctrl+shift+Enter instead of just Enter):

=VLOOKUP(A2&B2, Sheet1!$A$2:$A$1000&Sheet1!$C$2:$C$1000, 3, FALSE)

But I do not recommend that because it is inefficient and because
array-entered formulas are prone to human error: pressing just Enter by
mistake sometimes __seems__ to work (not really!) instead of producing an
Excel error.

It would be better to add a 4th column in Sheet1 (D2:D1000) with formulas of
the form =A2&B2.

Then use the following normally-entered formula (just press Enter as usual):

=INDEX(Sheet1!$C$2:$C$1000, MATCH(A2&B2, Sheet1!$D$2:$D$1000, 0))

joeu2004

unread,
Sep 18, 2013, 2:36:21 PM9/18/13
to
Errata.... I wrote:
> Assuming that Item is in A2:A1000, Brand is in B2:B1000, and Price is
> in C2:C1000, you might use the following array-entered formula (press
> ctrl+shift+Enter instead of just Enter):
> =VLOOKUP(A2&B2, Sheet1!$A$2:$A$1000&Sheet1!$C$2:$C$1000, 3, FALSE)

My bad! Use the following array-entered formula instead (press
ctrl+shift+Enter instead of Enter):

=INDEX(Sheet1!$C$2:$C$1000, MATCH(A2&B2,
Sheet1!$A$2:$A$1000&Sheet1!$B$2:$B$1000, 0))

But again: that is not really recommended for the reasons noted previously.

sachinku...@gmail.com

unread,
Sep 27, 2013, 8:05:45 AM9/27/13
to
hai


mtim...@smcstudents.ca

unread,
Oct 20, 2014, 10:13:37 PM10/20/14
to
Thanks worked like a charm!
0 new messages