Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Count Days Worked

Hi Steph,
Couldn't figure out a way to do it with formulas. The set up:
Emp Day1 Day2 Day3 Day4 Day5 Total DayCt
Emp1 5.00 3.50 3.00 11.50 3.00
Emp1 3.00 2.00 2.25 2.00 2.00 11.25 5.00
Emp1 3.00 3.00 1.00 7.00 3.00
Emp1 3.00 3.50 2.00 8.50 3.00
Emp2 8.00 8.00 8.00 8.00 8.00 40.00 5.00
Emp3 8.00 7.00 7.00 22.00 3.00
100.25


Emp1 38.25 5
Emp2 40 5
Emp3 22 3
100.25
Days 6 & 7 are hiddenrows, so I could I could paste it here. The summarry is
below the data, again for ease of presentation. There is a named range,
"EmpSummary". It is assumed that the this summary is a list of employees,
exactly as they appear in the data section.
Code:
Sub EmpCtDays()
Range("A1").Select
ActiveCell.Offset(1, 0).Range("A1").Select
Do Until ActiveCell.Value = ""
EmpName = ActiveCell.Value
DayCt = ActiveCell.Offset(0, 9).Value
ReturnAddress = ActiveCell.Address
DayCt2 = ActiveCell.Offset(1, 9).Value
If ActiveCell.Offset(1, 0).Value < EmpName Then
If DayCt DaySave Then DaySave = DayCt
GoSub WriteDays
Else
If DayCt2 DayCt Then
DaySave = DayCt2
Else
If DayCt DaySave Then DaySave = DayCt
End If
End If
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
If ActiveCell.Value = "" Then GoTo Done
WriteDays:
Application.Goto Reference:="EmpSummary"
Selection.Find(What:=(EmpName), After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 9).Value = DaySave
Range(ReturnAddress).Select
DaySave = 0
Return
Done:
End Sub

(If this is too hard to deal with, post here and I will get a notification,
leave your email and I will send the file)
Thanks. Hope it works, don't have all your data, so notsure that all
contingencies have been tested

"Steph" wrote:

Hi everyone. I have a data sheet that has a bunch of employees and the time
they worked. I am trying to figure out how to count the number of days each
employee worked in that week. The problem is that a given employee may have
worked on different tasks, and therefore shows up on more than i line (like
Emp1). The way I was doing it is on each row, I was doing a simple count
function. Then, on a different summary sheet, I used sumif to consolidate
the total hours worked. That works great for total hours worked, but # of
days worked return more than the actual # of days. So for Emp1, it returned
14. How can I formulate that so it returns 6? Thank you!!!!

Day1 Day2 Day3 Day4 Day5 Day6 Day7 Total
Emp 1 5.00 3.50 3.00 2.00 2.00 15.50
Emp 1 3.00 2.00 2.25 7.25
Emp 1 3.00 3.00 1.00 7.00
Emp 1 3.00 3.50 2.00 8.50
Emp 2 8 8.00 8.00 8.00 8.00 40.00
Emp 3 7.00 7.00 7.00 21.00



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Total days worked /20 to get actual months/days Cindy Excel Worksheet Functions 3 October 22nd 09 11:50 PM
Employee days worked (-Holidays, -weekends, Snow Days, etc) Denise Excel Discussion (Misc queries) 2 December 31st 08 04:37 PM
is there a formula to count days someone worked? IJCVegas Excel Worksheet Functions 3 November 5th 08 04:44 PM
FORMULA, DAYS WORKED TO VACATION DAYS John5835 Excel Worksheet Functions 2 July 31st 08 09:28 PM
How can I count amount of Days I worked per year on Excel ? AA On Windows Excel Worksheet Functions 2 September 27th 06 07:01 PM


All times are GMT +1. The time now is 11:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"