ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How can I have multiple "If" statements in one formula? (https://www.excelbanter.com/excel-discussion-misc-queries/65117-how-can-i-have-multiple-if-statements-one-formula.html)

MikeL

How can I have multiple "If" statements in one formula?
 
I would like to write a formula that looks at one cell and sees if there is a
certain letter, R, L or C. and depending on what letter is there it would add
so many days to another date. I am sure I did it before but I do not
remember how I did it. Can anyone help?

bpeltzer

How can I have multiple "If" statements in one formula?
 
=if(a1="R",5,if(a1="L",7,if(a1="C",10,"input error")))
If you've got more than three or four such conditions, you'll be better
served by using a vlookup.

"MikeL" wrote:

I would like to write a formula that looks at one cell and sees if there is a
certain letter, R, L or C. and depending on what letter is there it would add
so many days to another date. I am sure I did it before but I do not
remember how I did it. Can anyone help?


SVC

How can I have multiple "If" statements in one formula?
 
Use a nested IF statement. Say the original date is in cell A1 and the
letter R, L, or C is in B1 and you want to add 1 for R, 2 for L and 3 for C,
in cell C1 (which should be formatted as a Date) enter the formula
=IF(B1="R",A1+1,IF(B1="L",A1+2,IF(B1="C",A1+3)))

Modify the formula to reflect the correct cells and the desired additional
days.

"MikeL" wrote:

I would like to write a formula that looks at one cell and sees if there is a
certain letter, R, L or C. and depending on what letter is there it would add
so many days to another date. I am sure I did it before but I do not
remember how I did it. Can anyone help?


Roger Govier

How can I have multiple "If" statements in one formula?
 
Hi Mike

Supposing your date in B1 and the value you are testing is in A1.
Assuming want to add say 5 days for R, 3 days for L or 7 days for C
=B1+5*(A1="R")+3*(A1="L")+7*(A1="C")

--
Regards

Roger Govier


"MikeL" wrote in message
...
I would like to write a formula that looks at one cell and sees if
there is a
certain letter, R, L or C. and depending on what letter is there it
would add
so many days to another date. I am sure I did it before but I do not
remember how I did it. Can anyone help?




paul

How can I have multiple "If" statements in one formula?
 
one way
in another cell say b1 =if(a1="R",1,if(a1="L",2,3))
in another cell have =another date+B1
--
paul
remove nospam for email addy!



"MikeL" wrote:

I would like to write a formula that looks at one cell and sees if there is a
certain letter, R, L or C. and depending on what letter is there it would add
so many days to another date. I am sure I did it before but I do not
remember how I did it. Can anyone help?


daddylonglegs

How can I have multiple "If" statements in one formula?
 

Try this formula

=B1+LOOKUP(A1,{"C","L","R";1,2,3})


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=501254



All times are GMT +1. The time now is 07:16 PM.

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