SOLVED

Problem with an if formula

Copper Contributor

Trying to write an If formula. If cell A1 has A then formula A runs is cell C1.  If Cell A1 has B then formula B runs in cell C1.  This is what I tried but get an 

=IF(A1="UG",(IF(ISBLANK(B1),"",EDATE(B1,6)),("")),IF(A1="PS",(IF(ISBLANK(B1),"",EDATE(B1,8)),("")))

6 Replies
best response confirmed by Hans Vogelaar (MVP)
Solution

@Gunnie 

 

Does this work?

 

=IF(A1="UG",(IF(ISBLANK(B1),"",EDATE(B1,6))),IF(A1="PS",(IF(ISBLANK(B1),"",EDATE(B1,8)))))

Thank you Martin, it worked.

 

Regards, 

 

Gunnie

@Martin_Angosto 

So glad it worked! @Gunnie 

@Gunnie You have an answer already.

Even in the Answers forum:

Issues with an IF formula: IF A1 = A run formula A IF A1 = B then run - Microsoft Community

Although cross-posting without mentioning it is not good practice, I offer you another solution.

 

=IF(ISBLANK(B2),"",EDATE(B2,SWITCH(A2,"UG",6,"PS",8)))

 

Thanks Riny,
This one was different, I've never used SWITCH before. Formula worked well
This is the first time I've ever used any type of Forum, wasn't sure how it worked, hence the reasin for cross posting. I'm amazed and grateful for all the feedback
1 best response

Accepted Solutions
best response confirmed by Hans Vogelaar (MVP)
Solution

@Gunnie 

 

Does this work?

 

=IF(A1="UG",(IF(ISBLANK(B1),"",EDATE(B1,6))),IF(A1="PS",(IF(ISBLANK(B1),"",EDATE(B1,8)))))

View solution in original post