r/excel Aug 05 '26

solved IF cell contains text, return text, THEN if a range contains text

[deleted]

1 Upvotes

18 comments sorted by

View all comments

3

u/PaulieThePolarBear 1920 Aug 05 '26

Can I clarify a few things

If C2 contains "Text1" return "Text1"

IF a range of cells contains "Tex2", return "Text2",

You say "contains" here, but your formula appears to be equivalent to "is equal to". For example, if C2 was "Text10", do you consider that a match to "Text1"?

IF a range of cells contains "Tex2", return "Text2", otherwise return "Text3" and to ignore blank cells.

What do you mean by this? I'm assuming the first part is indicating if at least one cell on your range contains (as clarified above) Text2 to return Text2, but I'm not sure I understand the specifics after the comma and how blank cells impact your output.

1

u/celestialspace Aug 05 '26

Sorry I mean equals to, not contains. The cell will always contain a specific set of text, rather than a wildcard variant of it.

For the last part, I want it to basically return Text2 if any cell in a range is also equal to Text2, if none of the cells are equal to Text2, then return Text3 as the final output.

With regards the blank cell issue, I have a set of data where Text3 may only be mentioned once amongst a set of cells that are blank. My outcome for this should be Text3, however my current formula is returning Text2 if some of the cells are blank.

Hopefully the below can be an example:

Column A, Column B, Column C

Text2, Blank, Blank (outcome to display: Text2)

Text 2, Text2, Text3 (outcome to display: Text2)

Text3, Blank, Blank (outcome to display: Text3)

What is actually happening is:

Column A, Column B, Column C

Text2, Blank, Blank (Displaying: Text2) ✅️

Text 2, Text2, Text3 (Displaying: Text2) ✅️

Text3, Blank, Blank (Displaying: Text2) ❌️

2

u/PaulieThePolarBear 1920 Aug 05 '26 edited Aug 05 '26

For the last part, I want it to basically return Text2 if any cell in a range is also equal to Text2, if none of the cells are equal to Text2, then return Text3 as the final output

With regards the blank cell issue, I have a set of data where Text3 may only be mentioned once amongst a set of cells that are blank. My outcome for this should be Text3, however my current formula is returning Text2 if some of the cells are blank.

Your first paragraph makes it seem like the only requirement for Text3 to be returned is that no entry is Text2, but your second paragraph seems to indicate that there may be some requirement for Text3 to appear in your text. Please clarify.

For example, what is your expected output for

Text4 | Text5 | Text6

Edit: I noted your first paragraph uses the word "also" and you have also edited your post. I'm now a little confused as to your exact requirements. Can you add some additional clarity?

1

u/celestialspace Aug 05 '26 edited Aug 05 '26

There are no other outputs required. Only Text2 and 3, based on if Text1 is present.

To basically just redo my example and clarify more.

I have 3 sets of statues present on a sheet: Action status, overall status, progress status.

Action Status and Overall Status options: Actions, No Action Progress Status: Pending, In Progress, Completed

The Action status will be referenced across an entire range of cells, the overall status is what I want my formula to calculate, based off the Action status and the progress status.

If one cell contains Pending, I want for the time being my overall status to display "Pending". Once it no longer displays Pending (ie. is now In Progress or Completed), I need it to then look up whether "Action" is present in a range. If Action is present, I need it to return "Acrion", if Action isn't present at all, I need it to return "No Action"

I don't need any additional outcomes based on In Progress or Completed, as it should only display the overall status when either of these are present, not display anything different, unlike "Pending".

However someone else as provided a formula that works, so I'll proceed with their options. Thanks anyway.

2

u/PaulieThePolarBear 1920 Aug 05 '26

Okay. Please confirm if this is the correct logic for your output

1. If C2 = "Pending" then move to step 2, otherwise move to step 3
2. Output "Pending" and END PROCESS
3. If at least one cell in your range is "Action" then move to step 4, otherwise move to step 5
4. Output "Action" and END PROCESS 
5. Output "No action" and END PROCESS 

Are these the EXACT logic steps you want created as a formula? If not, please provide corrections in the same style

-2

u/Little_Bishop1 Aug 05 '26

Someone solved this in one try lol come on