I have an excel timesheet that I want to do a simple task - count if an
employee ever works 7 days in a row.
Any Ideas?
Thanks,
Patrick
Corey - 21 Jan 2007 02:28 GMT
Depends on how you have each day set up.
If you have a daily cell value with hours in it you could use something
like:
If Range("A1:A7").value <>"" then msgbox "The Employee has worked 7 days
straight."
' Where A1:A7 is the hrs worked for each day.
Corey....
>I have an excel timesheet that I want to do a simple task - count if an
> employee ever works 7 days in a row.
[quoted text clipped - 4 lines]
>
> Patrick
Tom Ogilvy - 21 Jan 2007 03:54 GMT
Range("A1:A7").value <>""
raises an error for me.

Signature
Regards,
Tom Ogilvy
> Depends on how you have each day set up.
> If you have a daily cell value with hours in it you could use something
[quoted text clipped - 13 lines]
>>
>> Patrick
Martin Fishlock - 21 Jan 2007 02:35 GMT
Patrick
This checks for series of 7 dates in a column:
=(2*MIN(B1:B7)+6)/2*7=SUM(B1:B7)
As in:
Row\Col A (Date) B (Ans)
1 25/1/2007 TRUE
2 26/1/2007 FALSE
3 27/1/2007 FALSE
4 28/1/2007 FALSE
5 29/1/2007 FALSE
6 30/1/2007 FALSE
7 31/1/2007 FALSE
8 FALSE
9 2/2/2007 TRUE
10 3/2/2007 FALSE
11 4/2/2007
12 5/2/2007
13 6/2/2007
14 7/2/2007
15 8/2/2007
You can then just do a
=if(countif(B:B,TRUE)>0,"Worked more than 6 days in a row","")
Otherwise do the same in VBA.

Signature
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.
> I have an excel timesheet that I want to do a simple task - count if an
> employee ever works 7 days in a row.
[quoted text clipped - 4 lines]
>
> Patrick
Chip Pearson - 21 Jan 2007 11:48 GMT
There are a number of ways to do this. How is your data laid out? How many
columns wide is the data? What does the data in each column mean? Are
non-worked days blanks or do they have a 0?
There are many way to lay out a timesheet, and a solution that applied to
one format may not work in another. You need to supply much more
information. Details count.

Signature
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)
>I have an excel timesheet that I want to do a simple task - count if an
> employee ever works 7 days in a row.
[quoted text clipped - 4 lines]
>
> Patrick