count numbers on or before today

Carolief

New Member
Joined
Nov 11, 2010
Messages
6
Hi,

I've got an excel sheet in which the amount of hours someone worked on a day are administrated (column c) by date (column b in 'dd mmm' format). When someone didn't work, the cell has to be empty.
I want to count the days that someone worked, including today.
<table border="0" cellpadding="0" cellspacing="0" width="128"><col style="width: 48pt;" width="64"> <col style="width: 48pt;" width="64"> <tbody><tr style="height: 12pt;" height="16"> <td class="xl75" style="height: 12pt; width: 48pt;" align="right" width="64" height="16">B
11 Nov</td> <td class="xl76" style="width: 48pt;" align="right" width="64">C
9.0</td> </tr> <tr style="height: 12pt;" height="16"> <td class="xl75" style="height: 12pt;" align="right" height="16">12 Nov</td> <td class="xl76" align="right">10.5</td> </tr> <tr style="height: 12pt;" height="16"> <td class="xl75" style="height: 12pt;" align="right" height="16">13 Nov</td> <td class="xl76">
</td> </tr> <tr style="height: 12pt;" height="16"> <td class="xl75" style="height: 12pt;" align="right" height="16">14 Nov</td> <td class="xl76">
</td> </tr> <tr style="height: 12pt;" height="16"> <td class="xl75" style="height: 12pt;" align="right" height="16">15 Nov</td> <td class="xl76" align="right">9.0</td> </tr> <tr style="height: 12pt;" height="16"> <td class="xl75" style="height: 12pt;" align="right" height="16">16 Nov</td> <td class="xl76" align="right">8.5</td> </tr> <tr style="height: 12pt;" height="16"> <td class="xl75" style="height: 12pt;" align="right" height="16">17 Nov</td> <td class="xl76" align="right">8.5</td> </tr> <tr style="height: 12pt;" height="16"> <td class="xl75" style="height: 12pt;" align="right" height="16">18 Nov</td> <td class="xl76" align="right">
</td> </tr> <tr style="height: 12pt;" height="16"> <td class="xl75" style="height: 12pt;" align="right" height="16">19 Nov</td> <td class="xl76" align="right">3.5</td> </tr> <tr style="height: 12pt;" height="16"> <td class="xl75" style="height: 12pt;" align="right" height="16">20 Nov</td> <td class="xl76">
</td> </tr> </tbody></table>
For the example above the formula should give 4 (have worked on 11, 12, 15 and today).
Hope someone can help me! Has been taking me way too long again...

Carolien
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Thanks! That works! Took me a while to understand though :).
Would you know how to solve it if there are days with 0 entered for worked hours which shouldn't be counted at worked days? Don't worry about answering if it takes too much time or effort, it's not important! I'm just curious.
Thanks again, for your quick reply and your great answer!

Carolien
 
Upvote 0
Thanks! That works! Took me a while to understand though :).
Would you know how to solve it if there are days with 0 entered for worked hours which shouldn't be counted at worked days? Don't worry about answering if it takes too much time or effort, it's not important! I'm just curious.
Thanks again, for your quick reply and your great answer!

Carolien

Are there repeats in the dates range, that is, 11 nov occurs more than once, for example? If 11 nov occurs twice and is associated with 9.0 and 10.0, does it count as 1 or 2?
 
Upvote 0
There are no repeats in the dates range. Thanks!

Assuming that the range is B2:C11...

Either:

Control+shift+enter, not just enter...

=SUM(IF(C2:C11>0,IF(B2:B11<=TODAY(),1)))

Or:

Just enter...

=SUMPRODUCT(--(C2:C11>0),--(B2:B11<=TODAY()))
 
Upvote 0
Thanks! I was so close... Nice to have other people who want to help you out on such a moment. That's great!

Carolien
 
Upvote 0

Forum statistics

Threads
1,215,693
Messages
6,126,248
Members
449,304
Latest member
hagia_sofia

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