**Question description:**

*This user has given permission to use the problem statement for this blog.*

I need help with a nested if statement returning text

Solved by X. B. in 13 mins

This is the chat thread from the real Excelchat help session. It contains no private user information.

Excelchat Expert
27/09/2018 - 05:34

Hello, I understand that you need help with a nested if statement.

Excelchat Expert
27/09/2018 - 05:34

Before we proceed, this is a reminder that our policy is 1 question per session so for this session we'll be resolving this particular question. We also currently do not support VBA/Macro solutions.

User
27/09/2018 - 05:34

I do indeed. Sounds good

Excelchat Expert
27/09/2018 - 05:35

I can see you typing a sample data in the sheet to the right. Please go ahead. I'll also be asking you a few questions once you are done.

Excelchat Expert
27/09/2018 - 05:38

May I have the details of what you need help with? I can see that you are trying to write an IF formula in column C, I may be able to help but I'll need the details of your requirement.

User
27/09/2018 - 05:38

Ok, so basically I need this if statement to return "1" if the CAPTION contains Birthday in it, a "2" if the caption is "Blank", a "3" if the caption is "Sympathy", and then a 0 if the caption contains none of these.

Excelchat Expert
27/09/2018 - 05:39

Okay, that makes sense. I'll be working on this using the sheet to the right. Please give me 3-5 minutes.

User
27/09/2018 - 05:39

As you can see the one I've come up with returns Birthday captions with a 1 but all of the others fail.

Excelchat Expert
27/09/2018 - 05:39

By the way, when you say "Blank" you mean the actual word BLANK, right?

User
27/09/2018 - 05:39

Yes

Excelchat Expert
27/09/2018 - 05:43

Please see the formula in column D. It can be moved to column C if you want.

User
27/09/2018 - 05:44

Looks like it works well

Excelchat Expert
27/09/2018 - 05:44

So basically, I took your formula but instead of going the nested IF route, I used the IFERROR function instead.

Excelchat Expert
27/09/2018 - 05:45

The reason for this is because if the first IF(SEARCH()) function is not found, it will result to an error which will stop the entire formula from working.

Excelchat Expert
27/09/2018 - 05:45

So we have to find a way in order to force the formula to evaluate even if the first and second returns an error.

User
27/09/2018 - 05:45

Makes sense!

Excelchat Expert
27/09/2018 - 05:46

Glad to have helped!

User
27/09/2018 - 05:46

I appreciate your speedy help

Excelchat Expert
27/09/2018 - 05:46

Would there be anything else that I can help you with regards to the original question?

User
27/09/2018 - 05:46

I think that is all

Excelchat Expert
27/09/2018 - 05:46

Alright, if you have no other questions regarding the original concern, I'd appreciate a 5-star rating and your feedback if you think I deserve it.

Excelchat Expert
27/09/2018 - 05:46

I'll be giving you high ratings as well so the other experts will know that you are a good client and should be taken care of.

Excelchat Expert
27/09/2018 - 05:46

Please do not forget to click the End Session button otherwise I'll be stuck here until the timer expires and be unable to help others. Thank you.

Excelchat Expert
27/09/2018 - 05:47

Here's your file, by the way.

[Uploaded an Excel file]

User
27/09/2018 - 05:47

Definitely 5 star quality. have a good day

Excelchat Expert
27/09/2018 - 05:47

Thank you I'd appreciate that. It would help me a lot. Please do not forget to click the End Session button so you can rate me.

**This is the output file from the real Excelchat help session:**

*This is an example of the expert help you can get. It contains no private user information.*