Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a sheet with employee time logs, as follows:

Name    Day1       Day2       Subtotal of 'OFF' days this period
Jess    PRESENT    OFF        1
Bob     PRESENT    PRESENT    0
Name    Day3       Day4       Subtotal of 'OFF' days this period
Jess    PRESENT    PRESENT    0
Bob     OFF        OFF        2

I need to create an automatic total of the number of days off each employee has had. How could I do this? =COUNTIF(1:100,"OFF") would return the total number of off days, but is there a way to get this total only rows where the first cell contains "Jess"?

(In this example, "OFF" is "STRING" in my question, while "Jess" is "IFTEXT")

share|improve this question
Are the columns within each period individual days? I would recommend doing subtotals by row and then getting your total from there- but I'm not sure I understand your setup. – batpigandme May 21 '13 at 15:52
Yes, they are individual days - I've edited for clarity. Suppose I did a subtotal of 'OFF' days at the end of each row, what would I then do? – tog22 May 21 '13 at 22:22
up vote 3 down vote accepted

If you don't want to precalculate the subtotal of off days, you can use an array formula:


A:A="Jess" returns a bunch of TRUE and FALSE, in your sample, it would be {TRUE, FALSE, FALSE, TRUE, FALSE}

B:C="OFF" returns another bunch of TRUE and FALSE, in your sample, it would be {FALSE, TRUE; FALSE, FALSE; FALSE, FALSE; FALSE, FALSE; FALSE, FALSE} (note semicolons denoting the different rows)

And those two multiplied is evaluated as:

From A:A="Jess"  From B:C="OFF"   Result
TRUE             (FALSE, TRUE ) = FALSE TRUE

Only a TRUE multiplied by another TRUE gives a result of TRUE. The *1 last converts every TRUE to 1. SUM then adds all the 1 together.

share|improve this answer

This worked for me when I tried it:


This allows you to "count if" on multiple criteria.

NOTE: The COUNTIFS function is only available in the new Google Sheets (released December 2013), so old spreadsheets that have not yet been converted will not be able to utilize it.

share|improve this answer

On the left of the table create a column for each employee. Set value to =IF(A{row}="{employee}",1,0), then you can just take the array product of this column and the subtotal column.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.