+ Reply to Thread
Results 1 to 19 of 19

Formula which can calculate hours and days in a week

Hybrid View

  1. #1
    Registered User
    Join Date
    03-07-2016
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    11

    Unhappy Formula which can calculate hours and days in a week

    https://onedrive.live.com/redir?resi...nt=photo%2cpng

    Hello every one. I have attached a screen shoot of my work sheet. On the worksheet, all data are from other worksheet. My column A and Row 1 and 2 are all formula. I want to use those data to do two things:
    1. How can I calculate how many hours and days each person has worked during a week (from Sun to Sat). I want those are formulated because once I change my raw data then this sheet will be charged too. And each time, I will have different week days in different column. For example: when I change to period between Feb 11 to March 25th the week day column are changed accordingly.
    2. How can I get the result from the data sheet to show me that who is working on which date.
    For example, a function can show me all the people who working on Feb 1st, Monday or any other workday as I requested.

    I use Filter function, but it doesn't work that great and smooth. I couldn’t find other better way to achieve my goals. Please help me out.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Formula which can calculate hours and days in a week

    Hi, welcome to the forum

    Please upload your file to the forum. Not all members are able - or willing - to access file-hosting sites

    Please upload a sample of your workbook, not a picture of your data. Pictures are pretty much impossible to edit, and no-one wants to re-type your data for you
    Also, not all members can upload picture files (Company firewalls and stuff) - and, depending on what browser is being used, some pics dont even show up on the forum

    Your workbook should show a small desensitized example of the data you are working with and a manual mockup of the expected results.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    03-07-2016
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    11

    Re: Formula which can calculate hours and days in a week

    Thank you and will do

  4. #4
    Registered User
    Join Date
    03-07-2016
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    11

    Re: Formula which can calculate hours and days in a week

    I don't know how to attach my work book to the file. when I click attachment icon it only shows a blank line. there are no selection of my computer root.
    And therefor I couldn't upload my file. Is someone can help me with this?

  5. #5
    Registered User
    Join Date
    03-07-2016
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    11

    Re: Formula which can calculate hours and days in a week

    Since I couldn't upload my workbook, I try to explain my question as follow. Hope someone know how to do it and help me on this one
    I have a work sheet like following. All datas are formulated and links from other working sheet . once I paste new raw data on that working sheet, this sheet will change too.the first column is employee names and and rest of column are showing how many hours they worked that day.

    Jan 26 Jan 27 Jan 28 Jan 29 Jan 30 Jan 31 Feb 1 Feb 2 Feb 3
    Thu wed Thu Fri Sta Sun Mon Thu Wed
    Name
    Bob 2.5 3 2 5 6 8 6 5
    Bill 3.5 4 2 5 5

    I want to using above data to achieve two goals.
    1. How can I calculate how many hours and days each person hasworked during a week (from Sun to Sat). I want those are formulated becauseonce I change my raw data then this sheet will be charged too. And each time, Iwill have different week days in different column. For example: when I changeto period between Feb 11 to March 25th the week day column are changedaccordingly.
    2. How can I get the result from the data sheet to show me that who is workingon which date.
    For example, a function can show me all the people who working on Feb 1st,Monday or any other workday as I requested.
    the results look like this
    name Total working hours Jan 26-30 Total days Jan 26-30 Total working hours Jan 31-Feb 6
    Bob 18.5 5 19
    Bill 14.5 4 5

    Date working employees
    Jan 26 Bob
    Bill
    Jan 27 Bob
    Bill
    Jan 28 Bob


    I use Filter function, but it doesn't work that great andsmooth. I couldn’t find any other way to achieve my goals. Please help me out.
    Thank you so much

  6. #6
    Forum Contributor Toonies's Avatar
    Join Date
    07-30-2009
    Location
    Newcastle, UK
    MS-Off Ver
    Excel 2016
    Posts
    511

    Re: Formula which can calculate hours and days in a week

    hi can you upload an example spreadsheet

    To upload a file

    Click Go Advanced
    Then Attachments
    Then in The Manage Attachments Window
    Click Add File
    Browse for file From your PC
    Once Selected Then Upload
    The Selected File should be shown in the bottom left corner (with a Tick in)
    Then Click Insert Inline
    Then Done

  7. #7
    Registered User
    Join Date
    03-07-2016
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    11

    Re: Formula which can calculate hours and days in a week

    Thank you for your reply but I couldn't upload the file. when I use attachment icon, it won't showing anything.just blank line.I don't know why maybe my internet setting is wrong.

  8. #8
    Forum Contributor Toonies's Avatar
    Join Date
    07-30-2009
    Location
    Newcastle, UK
    MS-Off Ver
    Excel 2016
    Posts
    511

    Re: Formula which can calculate hours and days in a week

    I have reported the attachment issue to admin, hopefully they will be able to resolve this soon.

  9. #9
    Registered User
    Join Date
    03-07-2016
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    11

    Re: Formula which can calculate hours and days in a week

    Thank you very much. I hope I can upload my workbook so genius guy like you can help me out

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Formula which can calculate hours and days in a week

    Reading your request in post 5...
    1. Do you mean that you will overwrite your raw data each time, or just keep adding to it?
    2. If keep adding to it, look at using the SUMIFS() function. You can set your start/end dates/times in their own cells and then reference them.
    3. to get the people working on a specific date, use this ARRAY formula...
    =IFERROR(INDEX(range-with-names,small(if(range-with-dates=cell-with-date,row(range-with-dates)-how-many-rows-in-heading),ROWS($A$1:A1))),"")
    entered using CTRL SHIFT ENTER

  11. #11
    Registered User
    Join Date
    03-07-2016
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    11

    Re: Formula which can calculate hours and days in a week

    I attached my work book now. Thank you for your instruction and reply
    I will change my Raw data sheet each time according to different pay period. and that is why I want to use a function which can summaries data according to weekdays
    Since my period time sometime across three weeks ( two partial weeks and one whole week). I want the excel identify the partial weeks and the whole week then sum the data accordingly.
    Please see my worksheet for detail.

    Thank you so much.
    Attached Files Attached Files

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Formula which can calculate hours and days in a week

    This is the method I have always used to upload files...

    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.

    I have reported this, and the tech team are looking into it

  13. #13
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Formula which can calculate hours and days in a week

    Sorry for the delay in getting back to you.

    1. Instead of that formula you have on Calc sheet, try this, copied down and across...
    =IFERROR(INDEX('Raw Data'!$B:$Q,MATCH(' Calculation '!$A3,'Raw Data'!$A:$A,0)+1,MATCH(' Calculation '!C$2,'Raw Data'!$B$4:$Q$4,0)),"")
    Although I notice that in some columns, you dont always reference the same set of hours? How do you determine which line to use?

    Also, do you really need all those gaps in there? If not, try this.

    In a helper column (I used U), put this in U5 and copy down...
    =IF(AND(A5<>"",A6="Driver Hours"),U4+1,U4)
    Copuied down

    Then you pull in JUST the names...
    A3=IFERROR(INDEX('Raw Data'!$A:$A,MATCH(ROW(A1),'Raw Data'!$U:$U,0)),"")
    copied down

    Now that we have a shorter, cleaner list, we can move on to the next part

  14. #14
    Registered User
    Join Date
    03-07-2016
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    11

    Re: Formula which can calculate hours and days in a week

    Hi Thank you for get back to me. your formulas are much more cleaner. I used the both formulas and they work like a charm. much more appreciated
    But in your formulas it only pull the "driver hours". in my raw data there are some employee have hours in other hours row as well. the hours I use in my Calculation sheet should be "Subtotal hours". Could you edit your formulas a bit so I can pull subtotal hours instead of driver hours. and yes i don't use the same reference columns for the hours because I want to caculat the weekly hours which star from Sunday to Sat and it stars again for each one. for example in this work sheet it come across three weeks. I have to calculate them separately which are Tue , Jan 26 to Sat Jan 30 ; Sun Jan 31 to Sat Feb 6; Sun Feb -7 to Wed Feb 10. and when the time period change the date of week in per column changes too. and each time I have to manually change the column reference to caculat different weekly hours. and this is my final issue to find out a formula can sum the weekly hours according to the date of the week.
    by the way, I couldn't get:=IFERROR(INDEX(range-with-names,small(if(range-with-dates=cell-with-date,row(range-with-dates)-how-many-rows-in-heading),ROWS($A$1:A1))),"")
    entered using CTRL SHIFT ENTER" this formula to work.
    Thank you so much for all your help

  15. #15
    Registered User
    Join Date
    03-07-2016
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    11

    Re: Formula which can calculate hours and days in a week

    I don't know if I ask too much favor of not. Could you help me out on the duplicated name too? In the raw data for the some reason we have to put same employee into different cells.they all have different hours under each name. for example Adam has 51 hours in one row and 30 hours in the other row, his total hours for the period is 81 hours. Is there a formula can help me sum all different hours together for the duplicated names.

  16. #16
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Formula which can calculate hours and days in a week

    If you want the subtotals, use this instead...
    =IFERROR(INDEX('Raw Data'!$B:$Q,MATCH(' Calculation '!$A3,'Raw Data'!$A:$A,0)+5,MATCH(' Calculation '!C$2,'Raw Data'!$B$4:$Q$4,0)),"")

    by the way, I couldn't get:=IFERROR(INDEX(range-with-names,small(if(range-with-dates=cell-with-date,row(range-with-dates)-how-many-rows-in-heading),ROWS($A$1:A1))),"")
    entered using CTRL SHIFT ENTER" this formula to work.
    I used a different method to pull in names, so you dont need that 1 now
    In a helper column (I used U), put this in U5 and copy down...
    =IF(AND(A5<>"",A6="Driver Hours"),U4+1,U4)
    Copuied down

    Then you pull in JUST the names...
    A3=IFERROR(INDEX('Raw Data'!$A:$A,MATCH(ROW(A1),'Raw Data'!$U:$U,0)),"")
    copied down
    In the raw data for the some reason we have to put same employee into different cells.they all have different hours under each name. for example Adam has 51 hours in one row and 30 hours in the other row, his total hours for the period is 81 hours.
    can you give me row numbers where this is happening please?
    You would normally use SUMIF() for this type of calc

  17. #17
    Registered User
    Join Date
    03-07-2016
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    11

    Re: Formula which can calculate hours and days in a week

    Thank you for your reply. the sample sheet I gave to you doesn't have those duplicated names. but in my real working sheet,it has a lot of duplicated names. Sorry about the trouble.
    Can we assume there are duplicated names in row 15 ? I tried it on my sheet and the new problem occurred with the formula you sent to me. it can't differentiate the duplicated name and return the same value for both names.but they are really have different set of hours for each name.

  18. #18
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Formula which can calculate hours and days in a week

    So if the name is the same, but repeated, you want that as another entry, and not added together?

  19. #19
    Registered User
    Join Date
    03-07-2016
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    11

    Re: Formula which can calculate hours and days in a week

    no, I want to adding together.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formula to calculate days and hours remaining in SPECIFIC months.
    By jmewebb in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-07-2014, 10:17 AM
  2. [SOLVED] Formula to Calculate Normal Hours, Time & 1/2 & Double Time from Daily Hours per week
    By KazzICC in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-17-2014, 01:51 AM
  3. [SOLVED] Need Formula to Calculate Overtime from Daily hours for a whole week
    By KazzICC in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-13-2014, 08:05 PM
  4. Chart days of week x hours
    By cascao in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-12-2013, 04:47 AM
  5. [SOLVED] 40 Hours per week / how to calculate overtime hours
    By hudsonic72 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-07-2013, 02:33 AM
  6. Formula to Calculate Hours over Week Range
    By ssteines in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-20-2010, 10:41 AM
  7. How do I calculate the week day hours between 2 days
    By Mickey in forum Excel General
    Replies: 1
    Last Post: 10-05-2005, 08:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1