SOLVED

# Problem with an if formula

Copper 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),"",EDATE(B1,6)),("")),IF(A1="PS",(IF(ISBLANK(B1),"",EDATE(B1,8)),("")))

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

# Re: Problem with an if formula

Does this work?

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

# Re: Problem with an if formula

Thank you Martin, it worked.

Regards,

Gunnie

# Re: Problem with an if formula

So glad it worked! @Gunnie

# Re: Problem with an if formula

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)))``

# Re: Problem with an if formula

Thanks Riny,
This one was different, I've never used SWITCH before. Formula worked well

# Re: Problem with an if formula

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

# Re: Problem with an if formula

Does this work?

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