ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   IF function (https://www.excelbanter.com/excel-worksheet-functions/141839-if-function.html)

kivikatz

IF function
 
I would like to replicate an "IF" function to encompass several rows of data.
For instance, I have the formula =IF(A1=B1,C1,C1), which I want the cell to
show C1 whenever A1=B1 (Cell A1 is a validation list showing data from
B1:B20). I want the "IF" formula to encompass all the rows of B data
(B1:B20), so that if A is on B2, it should show C2, and if on B3, it should
show C3, and so forth). Is it possible to create a formula within a cell A1
to do that? Many thanks.

Toppers

IF function
 
Assuming C data is from C1:C20

=INDEX($C$1:$C$20,MATCH($A$1,$B$1:$B$20,0))

BUT you can't have formula and value in the same cell i.e the above cannot
be in A1 if understood you correctly.

HTH

"kivikatz" wrote:

I would like to replicate an "IF" function to encompass several rows of data.
For instance, I have the formula =IF(A1=B1,C1,C1), which I want the cell to
show C1 whenever A1=B1 (Cell A1 is a validation list showing data from
B1:B20). I want the "IF" formula to encompass all the rows of B data
(B1:B20), so that if A is on B2, it should show C2, and if on B3, it should
show C3, and so forth). Is it possible to create a formula within a cell A1
to do that? Many thanks.


JE McGimpsey

IF function
 
One way:

=IF(ISNA(MATCH(A1,B1:B20,FALSE)),"",VLOOKUP(A1,B1: C20,2,FALSE))


In article ,
kivikatz wrote:

I would like to replicate an "IF" function to encompass several rows of data.
For instance, I have the formula =IF(A1=B1,C1,C1), which I want the cell to
show C1 whenever A1=B1 (Cell A1 is a validation list showing data from
B1:B20). I want the "IF" formula to encompass all the rows of B data
(B1:B20), so that if A is on B2, it should show C2, and if on B3, it should
show C3, and so forth). Is it possible to create a formula within a cell A1
to do that? Many thanks.


kivikatz

IF function
 
Thanks. That formula works out well.

"Toppers" wrote:

Community Message Not Available



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

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