IF statement to return different words for condition A, condition B, or both A and B.

Worksong

New Member
Joined
Mar 23, 2024
Messages
21
Office Version
  1. 365
Platform
  1. Windows
Hello! I am struggling to write an IF statement that will return different text depending on whether one of two conditions is met, or both conditions are met. The worksheet tallies adult and childhood ADHD symptoms from two different categories - inattentive and hyperactive/impulsive; I'm only interested in the adult totals for the formulae.

Condition A: Five or more adult inattentive symptoms - return "Inattentive"
Condition B: Five or more adult hyperactive/impulsive symptoms - return "Hyperactive"
Condition C: Conditions A and B both met - return "Combined"
No condition met - return a blank cell (not FALSE).

So far I've been able to make functional IF statements that correctly return "Inattentive" or "Hyperactive", and one that correctly returns "Combined", but not one that correctly combines the two.

The Inattentive symptom tally is in cell D17
The Hyperactive/Impulsive symptom tally is in cell D31

Here are the formulas I've tried so far:
=IF(AND(D17>=5,D31>=5),”Combined”,IF(D17>=5,”Inattentive”,IF(D31>=5,”Hyperactive”)))
=IF(D17>=5,”Inattentive”,IF(AND(D31>=5,”Hyperactive”,IF(AND(D17>=5,D31>=5),”Combined”)))

This formula correctly returns the "one or the other" condition:
=IF(D17>=5,"Inattentive",IF(D31>=5,"Hyperactive"))

This one correctly returns the "both" condition:
=IF(AND(D17>=5, D31>=5), "Combined","")

Any suggestions are appreciated!
David

Here's the whole worksheet:
Copy of ADHD Questionnaires Scoring Spreadsheet Draft 041824.xlsm
I
32
DIVA-5
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
what happens with this formula - all i have added is "" blank so if none are met you get a blank and not false

=IF(AND(D17>=5,D31>=5),”Combined”,IF(D17>=5,”Inattentive”,IF(D31>=5,”Hyperactive”,"")))
 
Upvote 0
Solution
Hi Wayne, thanks for the reply. With that formula, if none of the conditions are met, a blank cell is indeed returned. Any condition met returns "#NAME?"
 
Upvote 0
You need to change the quotes from smart quotes (ie ”) to normal quotes (ie ")
 
Upvote 0
You need to change the quotes from smart quotes (ie ”) to normal quotes (ie ")
Problem solved, y'all. Thanks to you, @Sergius , and @etaf ! So the style of quotes is what was tripping me up this whole time … sheesh. Picky picky picky, Excel.

I'm not sure who to mark as having the solution and it won't let me select all three, so I'm going with @etaf because he provided the formula, but input from all three of you helped.

David
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,774
Messages
6,174,453
Members
452,565
Latest member
curtoliver68

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