ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   If and VLOOKUP Query (https://www.excelbanter.com/excel-discussion-misc-queries/157991-if-vlookup-query.html)

John Moore

If and VLOOKUP Query
 
Hi guys, I am trying to use an IF statement with a VLOOKUP function to return
data based on one of two criteris ,, e.g. column A is where I want to place
the formula, column B is the first criteria, column C is the 2nd criteria
,,,, what I want to see in column A is the result from doing a VLOOKUP on
column B ( using a matrix ) and if the return data is "Unknown" then VLOOKUP
column C and return the result form the same matrix ,,,, i.e.
If(VLOOKUP(B1,Matrix,2,0)="Unknown",Vlookup(C1,mat rix,2,0) ...... anyone know
of an easy solution?
A B C
nuts Bolts

T. Valko

If and VLOOKUP Query
 
You have the right idea. You just need to finish it:

=IF(VLOOKUP(B1,Matrix,2,0)="Unknown",VLOOKUP(C1,Ma trix,2,0),VLOOKUP(B1,Matrix,2,0))--BiffMicrosoft Excel MVP"John Moore" wrote in ... Hi guys, I am trying to use an IF statement with a VLOOKUP function toreturn data based on one of two criteris ,, e.g. column A is where I want toplace the formula, column B is the first criteria, column C is the 2nd criteria ,,,, what I want to see in column A is the result from doing a VLOOKUP on column B ( using a matrix ) and if the return data is "Unknown" thenVLOOKUP column C and return the result form the same matrix ,,,, i.e. If(VLOOKUP(B1,Matrix,2,0)="Unknown",Vlookup(C1,mat rix,2,0) ...... anyoneknow of an easy solution? A B C nuts Bolts


T. Valko

If and VLOOKUP Query
 
Yikes! I have no idea how that reply got all jammed together like that. Here
it is again:

You have the right idea. You just need to finish it:

=IF(VLOOKUP(B1,Matrix,2,0)="Unknown",VLOOKUP(C1,Ma trix,2,0),VLOOKUP(B1,Matrix,2,0))--

--
Biff
Microsoft Excel MVP



Jim Thomlinson

If and VLOOKUP Query
 
you can use either countif or isna to determine if your vlookup is going to
find a value so in general here is the theory of what you want

if(countif(A1:A100, "Apple")<0, vlookup("apple", A1:D100, 4, false),
if(countif(B1:B100, "Orange") < 0, Vlookup("Orange", B1:D100, 3, False),
"NA"))

ISNA would be similar but in general
if(isna(vlookup(...), Not found, vlookup(...))
--
HTH...

Jim Thomlinson


"John Moore" wrote:

Hi guys, I am trying to use an IF statement with a VLOOKUP function to return
data based on one of two criteris ,, e.g. column A is where I want to place
the formula, column B is the first criteria, column C is the 2nd criteria
,,,, what I want to see in column A is the result from doing a VLOOKUP on
column B ( using a matrix ) and if the return data is "Unknown" then VLOOKUP
column C and return the result form the same matrix ,,,, i.e.
If(VLOOKUP(B1,Matrix,2,0)="Unknown",Vlookup(C1,mat rix,2,0) ...... anyone know
of an easy solution?
A B C
nuts Bolts


Toppers

If and VLOOKUP Query
 
this ..?

=IF(ISNA(VLOOKUP(B1,matrix,2,0)),IF(ISNA(VLOOKUP(C 1,matrix,2,0)),"Unknown",VLOOKUP(C1,matrix,2,0)),V LOOKUP(B1,matrix,2,0))

"John Moore" wrote:

Hi guys, I am trying to use an IF statement with a VLOOKUP function to return
data based on one of two criteris ,, e.g. column A is where I want to place
the formula, column B is the first criteria, column C is the 2nd criteria
,,,, what I want to see in column A is the result from doing a VLOOKUP on
column B ( using a matrix ) and if the return data is "Unknown" then VLOOKUP
column C and return the result form the same matrix ,,,, i.e.
If(VLOOKUP(B1,Matrix,2,0)="Unknown",Vlookup(C1,mat rix,2,0) ...... anyone know
of an easy solution?
A B C
nuts Bolts



All times are GMT +1. The time now is 12:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com