How can I change the value of one cell based on the values of multiple cells?

CaitlinStevens

New Member
Joined
Mar 29, 2022
Messages
4
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
  2. MacOS
I have created a spreadsheet to monitor the testing results of lighting. If the word 'Fail' is entered at least once in a range of cells, I would like the word 'Fail' to show in another cell as the overall result.

I have used the formula =IF(COUNTIF(M5:M8,"*Fail*")=COLUMNS(M5:M8),"Fail","Pass") which does seem to work if the word 'Fail' is only listed once in the range, however if the word 'Fail' is listed more than once then the other cell changes to 'Pass' instead.

Can someone please help?

Thank you in advance!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi,

Take the COLUMNS(M5:M8) part out, this part is Always =1, so just:

Excel Formula:
=IF(COUNTIF(M5:M8,"*Fail*"),"Fail","Pass")

ALSO, if you Only have the Single word "Fail" in the range M5:M8, you can take the * (wildcard) out, unless you have Other words mixed in like (e.g. Failed, Failing, Definitely Failed, etc.)
 
Upvote 0
Solution
Hi,

Take the COLUMNS(M5:M8) part out, this part is Always =1, so just:

Excel Formula:
=IF(COUNTIF(M5:M8,"*Fail*"),"Fail","Pass")

ALSO, if you Only have the Single word "Fail" in the range M5:M8, you can take the * (wildcard) out, unless you have Other words mixed in like (e.g. Failed, Failing, Definitely Failed, etc.)
Wow, thank you so much. This has worked!

I forgot to add that if a cell is blank, this shouldn't be given the value of 'Pass' - it should just remain blank. Is there a way I can incorporate this into your formula please?
 
Upvote 0
You're welcome.

Wow, thank you so much. This has worked!

I forgot to add that if a cell is blank, this shouldn't be given the value of 'Pass' - it should just remain blank. Is there a way I can incorporate this into your formula please?

Do you have formulas in the range M5:M8, or are those Pass/Fail manually entered, again, I'd like to point out if you have Only the word "Fail" in the cells, you don't need the wildcard.
 
Upvote 0
You're welcome.



Do you have formulas in the range M5:M8, or are those Pass/Fail manually entered, again, I'd like to point out if you have Only the word "Fail" in the cells, you don't need the wildcard.
Thank you, the words 'Pass' and 'Fail' would be entered manually so I have removed the wildcard as suggested. My only problem now is that when the cell is blank, it automatically changes to 'Pass' and should instead just remain blank. I hope that makes sense? Appreciate your help!
 
Upvote 0
This should work:

Excel Formula:
=IF(COUNTA(M5:M8)=0,"",IF(COUNTIF(M5:M8,"Fail"),"Fail","Pass"))
 
Upvote 0
This should work:

Excel Formula:
=IF(COUNTA(M5:M8)=0,"",IF(COUNTIF(M5:M8,"Fail"),"Fail","Pass"))
Oh my goodness, you are a lifesaver!!! Thank you so much, I am honestly so grateful for your help.
 
Upvote 0
You're welcome, thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,025
Messages
6,122,734
Members
449,094
Latest member
dsharae57

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top