# CountIFs text before today

#### flyyboy84

##### New Member
I do not have permissions to post attachments so I will try to explain as best I can.

I have dates in Row 1 that go to the end of the year (some dates are before today and some are after)

In rows 2-5 I have names workers that randomly work shifts on those dates.

I have a column of all the names listed and would like to count the number of shifts each person has worked UP TO today.

I have a cell with today's date , =Today()

This is what I have come up with, but there is a formatting error.

=COUNTIFS(B2:F5,H2,B1:F1,"<="J2)

B2:F5 is the range of names who are working the shifts under each column date
B1:F1 is the dates in order, some are before today and some are after
H2:H6 are the list of worker names (I would like the total shifts prior to today to be displayed in I2:I6 next to corresponding name
J2 is =Today()

### Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

#### Norie

##### Well-known Member
Try this.

=COUNTIFS(B2:F5,H2,B1:F1,"<=" & J2)

#### steve the fish

##### Well-known Member
Maybe sumproduct.

=SUMPRODUCT((B1:F1<=J2)*(B2:F5=H2))

#### flyyboy84

##### New Member
Thanks, but that's the exact formula I have (forgot to add that to my original post), but it comes up with a #VALUE ! error (I think due to formatting).

#### flyyboy84

##### New Member
Your the man Steve! Thanks, this worked!

Last edited:

Replies
3
Views
660
Replies
1
Views
266
Replies
1
Views
126
Replies
4
Views
146
Replies
2
Views
73

1,148,294
Messages
5,745,944
Members
423,985
Latest member
sayed manzar

### 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.

### Which adblocker are you using?

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

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