+ Reply to Thread
Results 1 to 5 of 5

Formula to calculate total for each unique value

  1. #1
    Registered User
    Join Date
    10-08-2010
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    3

    Unhappy Formula to calculate total for each unique value

    I have an excel sheet which has two columns- Employee ID and Number of hours worked on project. Employee IDs and Number of hours worked go like this-

    ID Hours worked on project

    101 .76
    101 .33
    102 .97
    103 .77
    103 .54
    103 .65
    103 .66
    104 .87
    104 .64

    This goes on for 1830 ID values


    I need a formula to calculate the total number of hours worked by each employee, for example Employee 101 has worked a total of 1.09 hours. Employee 102 has worked .97 hours. Employee 103 has worked 2.62 hours and so on for each employee. Each employee ID occurs multiple times (in many cases) because each employee works on several projects at the same time.

    Please give me a formula, thank you very much for the help!
    Last edited by sashwin99; 10-08-2010 at 06:48 AM. Reason: Change title of post

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Formula to calculate total for each unique value

    Thanks for changing your thread title.

    With your Data sorted on Column A (ID)
    in C2
    Please Login or Register  to view this content.
    Drag/Fill Down

    Filter column C for non-blanks.

    If, for some reason, you are not allowed to sort column A then you will need to use a lookup list of unique IDs

    Hope this helps
    Last edited by Marcol; 10-08-2010 at 05:20 AM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  3. #3
    Registered User
    Join Date
    10-08-2010
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Formula to calculate total for each unique value

    Thank you very much. Worked superbly.

    Now, how do I filter the values by ID, so that the total for each ID is shown only once?

    Each ID occurs randomly throughout the spreadsheet.

    For example,

    ID No. of hours
    101 2.3
    101 2.3
    102 4
    104 6.8
    101 2.3
    102 4
    103 7
    101 2.3

    Please suggest a formula for each ID to be displayed just once, and in the right order like this:

    ID No. of hours
    101 2.3
    102 4
    103 7
    104 6.8

    I also need to copy all this data to another spreadsheet where duplicate IDs have been eliminated, but ID numbers occur randomly like this:

    ID No.of hours
    103 7
    101 2.3
    102 4
    186 11
    479 3
    104 6.8


    Thank you very much, and sorry to trouble!
    Last edited by sashwin99; 10-08-2010 at 06:47 AM.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Formula to calculate total for each unique value

    Re: Part One

    Why not just use a Pivot Table ? Set "ID" as Row Label and "Hours Worked on Project" as Data Field set to SUM.
    Job done - 10 secs (max)

    Re: Job Two

    Will depend on Part One
    Last edited by DonkeyOte; 10-08-2010 at 07:04 AM.

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Formula to calculate total for each unique value

    As I said earlier the formula will only give a clean result if your data is sorted by Column A (ID)

    as you already have a lookup list of unique values in another sheet then you can use
    Please Login or Register  to view this content.
    Adjusted to suit.

    DonkeyOtes suggestion to use a pivot table does all this for you

    I have put all the alternative solutions in this demo workbook
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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