COUNTA (with countif) with OR condition

Lebene

New Member
Joined
Sep 20, 2019
Messages
40
Platform
  1. Windows
Hello,

You may remember me from before, I was helped to full through three different attendance types. It works lovely and I'm still trying to understand it... haha...

I've come into another road bump. I had somehow figured out how to do countif with counta (I did it in a trance and was actually shocked when I checked one day and saw it) - my only issue is that I don't want it to count 'Declared' as a non-attendance and hence lowering the percentage I get:

Capture.png
[/URL][/IMG]
I'm using this formula:
=COUNTIF($D7:$U7,"Attended")/COUNTA($D7:$U7)

What I'm expecting to see in Workshop 2 overall attendance is 100%.

This formula didn't work:
=COUNTIF($D7:$U7,"Attended")+COUNTIF($D7:$U7,"Declared")/COUNTA($D7:$U7)

=COUNTIF($D7:$U7,"Attended")/COUNTA($D7:$U7)+COUNTIF($D7:$U7,"Declared")/COUNTA($D7:$U7)

Thanks for any help!
 
Last edited by a moderator:

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
How about
=SUM(COUNTIF(D7:U7,{"Declared","Attended"}))/COUNTA(D7:U7)
 
Upvote 0
Thank you, this worked a treat!! I had tried =COUNTIF(D7:U7,{"Attended",{"Declared"})/COUNTA(D7:U7) - in lieu with the help you gave be previously, I was just trying to see but it didn't do anything.
How come introducing the '=sum' element finally made it work?

How about
=SUM(COUNTIF(D7:U7,{"Declared","Attended"}))/COUNTA(D7:U7)
 
Upvote 0
Using the array {"Declared","Attended"} will give you two separate counts, so the SUM function simply adds them together.
 
Upvote 0
Ah, I see.
So essentially what Excel is doing, which isn't explicit in the formula is =SUM(COUNTIFSCRITERIA 1 + COUNTIFS CRITERIA 2

Using the array {"Declared","Attended"} will give you two separate counts, so the SUM function simply adds them together.

Thank you again!
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,020
Messages
6,122,709
Members
449,093
Latest member
Mnur

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