Reputation: 259
I have a spreadsheet with a table containing multiple weeks, it has columns and rows like so:
Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat Sun Mon
A letter "H" will be enters for a users/day when they have booked some holiday, I need to count for each user the number of each days that they have taken as holiday.
I wrote the formula: =COUNTIF(INDEX($N:$NMMATCH("Sun",$N:$NM)),"H")
But this obviously it only returns a count for the first "Sun" column it finds and ignores all the Sundays after.
Does anyone know how this can be accomplished?
Upvotes: 2
Views: 1989
Reputation: 3678
Use COUNTIFS:
=COUNTIFS(2:2;"H";$1:$1;"Sun")
Now if you make a small table with Mon up to Sun as headers above it and refer to that for the 4th parameter you can ditch the "Sun"
Upvotes: 2
Reputation: 46331
If the range for user 1 is N2:NM2 and the headers are in N1:NM1 try this formula to count Suns with "H"
=COUNTIFS(N$1:NM$1,"Sun",N2:NM2,"H")
You can copy that down for all users
Upvotes: 2