Using Logical Formulae to determine if all cells are equal to or below a given number, and not blank

kjgarbutt

New Member
Joined
Dec 22, 2018
Messages
6
Hi all,

I am analysing some survey data and I am trying to group a set number of questions together so that I can determine if a patient has rated their pain equal to or below 4 (out of 10) for ALL of the chosen questions. An example of the data is below. As well as the formula I am currently using.

The problem I have noticed is that the formula will show "ALL < = 4" even if NO data is in the cells. Logically this makes sense, but a 0 and blank cell are very different in this respect. What I need is:

IF a number is present AND it is EQUAL to or LESS than 4 in each of these cells (ATI2,ATQ2,...), RETURN "ALL < = 4", ELSE RETURN " " (nothing!).

I'm not entirely sure how to do that. Any help or guidance as to how best to do this would be much appreciated.


Question C8Question C10Question C13Question C20Question C21Question C27Question C33ALL NRS < = 4
7778599
2ALL NRS < = 4
ALL NRS < = 4
3320ALL NRS < = 4

<tbody>
</tbody>


=IF((AND(ATI2<=4, ATQ2<=4,ATS2<=4,AVV2<=4,AVW2<=4, AWR2<=4,BAF2<=4)), "ALL < = 4", " ")
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Welcome to Mr Excel,

Try

Code:
=IF(AND(COUNTA(A2:G2)>=1,COUNTIFS(A2:G2,"<="&4)=COUNTA(A2:G2)),"All NRS <= 4","")
 
Last edited:
Upvote 0
Merry Christmas to you too!

Actually, I have a related question: how do I do the same thing, but this time I want to determine if AT LEAST 1 of the cells is LESS than or EQUAL to 4, but NOT including blanks cells?

I've tried to adapt your earlier formula, but I think it needs an OR somewhere. Not sure.

=IF(AND(COUNTA(BCH2:BCN2)>=1,COUNTIFS(BCH2:BCN2,"<"&3)=COUNTA(BCH2:BCN2)),"AT LEAST 1 < 3","")
 
Upvote 0
Merry Christmas to you too gaz_chops!


Actually, I have a related question: how do I do the same thing, but this time I want to determine if AT LEAST 1 of the cells is LESS than or EQUAL to 4, but NOT including blanks cells?


I've tried to adapt your earlier formula, but I think it needs an OR somewhere. Not sure.


Code:
=IF(AND(COUNTA(BCH2:BCN2)>=1,COUNTIFS(BCH2:BCN2,"<"&4)=COUNTA(BCH2:BCN2)),"AT LEAST 1 <= 4","")


Note: messed up formatting in an earlier reply and couldn't see an 'edit' button.
 
Upvote 0
Misread, try

Code:
=IF(AND(COUNTA(A2:G2)>=1,COUNTIFS(A2:G2,"<="&4)),"All NRS <= 4","")

Change text at end "ALL NRS....." to "AT LEAST...."
 
Last edited:
Upvote 0
You sir or madam are my festive hero!

I need to up my Excel formula knowledge. Thank you so much for the help.
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,393
Members
449,081
Latest member
JAMES KECULAH

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