Forum Discussion
Gunnie
May 15, 2024Copper Contributor
Problem with an if formula
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),"",EDA...
- May 15, 2024
Does this work?
=IF(A1="UG",(IF(ISBLANK(B1),"",EDATE(B1,6))),IF(A1="PS",(IF(ISBLANK(B1),"",EDATE(B1,8)))))
Riny_van_Eekelen
May 16, 2024Platinum Contributor
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)))
Gunnie
May 16, 2024Copper Contributor
Thanks Riny,
This one was different, I've never used SWITCH before. Formula worked well
This one was different, I've never used SWITCH before. Formula worked well