+ Reply to Thread
Results 1 to 9 of 9

Calculation based on multiple criteria

  1. #1
    Registered User
    Join Date
    06-04-2013
    Location
    Franklin, TN
    MS-Off Ver
    Excel 2007
    Posts
    5

    Calculation based on multiple criteria

    I am trying to figure out how to calculate the amount of time it takes to work a claim based on date, time, and the username. I am trying to figure out a user's time spent going from claim to claim based on the day they worked it and the time stamp associated with it. The column I am trying to complete is the "Time to Work" column (Column E). Attached is the spreadsheet I am working from.

    Time Stamp.xlsx

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Calculation based on multiple criteria

    Hi ExcelAudio,

    Here's a VBA routine that does what I think you want:

    Please Login or Register  to view this content.
    Directions for running the routine(s) just supplied

    Copy the code to the clipboard

    Press ALT + F11 to open the Visual Basic Editor.

    Open a macro-enabled Workbook or save your Workbook As Macro-Enabled

    Select “Module” from the Insert menu

    Type "Option Explicit" then paste the code under it

    With the cursor between Sub and End Sub press F5 (F8 to Single Step)

    OR

    Press ALT + Q to close the code window.

    Press ALT + F8 then double click on the macro name
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    06-04-2013
    Location
    Franklin, TN
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Calculation based on multiple criteria

    Thank you for the code, I have almost got what I need. The math seems to be correct, except the calculation provided is assuming the prior claim is an "open" time stamp. I need the flip side of that, where, if MDLegran closed a claim at 8:48:42 AM and the prior claim that day was closed at 7:49:53 AM, then the row with 8:48:42AM should show the 0:58:49 as the "Time to Work". As it stands with the provided code, it's showing 7:48:06 AM as 58:49. Does that make sense? Below is what I'm seeing and below that will be what I want to see.

    Current provided code result:
    95 11319BZ4349 5/1/2013 7:49:53 AM 0:58:49 30 MDLegran
    814 12291980048 5/1/2013 8:48:42 AM 0:57:53 645 MDLegran

    What I need it to look like:
    95 11319BZ4349 5/1/2013 7:49:53 AM 0:25:30 30 MDLegran
    814 12291980048 5/1/2013 8:48:42 AM 0:58:49 645 MDLegran (as you can see, it took 58 min to work this claim).

    Thank you again for providing the code. I look forward having a solution to my issue

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Calculation based on multiple criteria

    Hi ExcelAudio,

    I thought that we would know how much time was spent on the earlier project by when the next project was started - I don't get attributing 0:58:49 to 8:48:42 because at that line the next project was just started


    Or, are the times logged the finishing times?
    Last edited by xladept; 06-05-2013 at 12:30 PM.

  5. #5
    Registered User
    Join Date
    06-04-2013
    Location
    Franklin, TN
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Calculation based on multiple criteria

    Hi xladept,

    Thank you for responding so quickly again. To answer your question, the time stamp reflects when the user closed the claim. If the user closes claim 1 on the unique day, the time should technically be null because there is no starting point for the first claim. The 2nd claim for that day should be the time stamp for claim 2 minus the time stamp for claim 1. The 3rd claim should be the time stamp for claim 3 minus the time stamp of claim 2. The repetition continues throughout the spreadsheet based on the user and the day. The reason for this is because the time stamp shows when the user closed the claim. If the time stamp was when the user "opened" the claim, I believe your code would be spot on perfect. However, because the time stamp is based on when the claim was closed, we have to essentially "work backwards". Does that make more sense?

  6. #6
    Registered User
    Join Date
    06-04-2013
    Location
    Franklin, TN
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Calculation based on multiple criteria

    Quote Originally Posted by xladept View Post
    Hi ExcelAudio,

    I thought that we would know how much time was spent on the earlier project by when the next project was started - I don't get attributing 0:58:49 to 8:48:42 because at that line the next project was just started


    Or, are the times logged the finishing times?


    To answer your question, the logged times are the finishing times. That's probably simpler than my prior explanation.

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Calculation based on multiple criteria

    Hi ExcelAudio,

    This yields the 58:49

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    06-04-2013
    Location
    Franklin, TN
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Calculation based on multiple criteria

    This solved my question! Thank you so much! I am eternally grateful!

    Quote Originally Posted by xladept View Post
    Hi ExcelAudio,

    This yields the 58:49

    Please Login or Register  to view this content.

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Calculation based on multiple criteria

    You're welcome!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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