+ Reply to Thread
Results 1 to 13 of 13

Need Help with a sum formula based off criteria within the same tab

  1. #1
    Registered User
    Join Date
    10-03-2019
    Location
    Kansas City
    MS-Off Ver
    2016
    Posts
    5

    Need Help with a sum formula based off criteria within the same tab

    Good Morning,

    I was wondering if anyone could guide me in the right direction with a formula. I need a formula that sums multiple cells based off certain criteria.

    I need the sum of "cost" for each employee based on county. For example below I have John's name in column (A) several times however John could work in numerous counties within a month's time frame. How can I get the total cost (E) for John per County?

    (A)Employee: John,(D) Hours: 40, (E) Cost: $150, (F) County: Clay, (L) Gross: $5706; (M) Per Hour: $36.91
    (A) Employee: Sue,(D) Hours:10, (E) Cost $40, (F) County: Clinton, (L) Gross: $3481, (M) Per Hour: $34.81
    (A) Employee: Bob, (D) Hours: 20, (E) Cost: $90, (F) County: Clay, (L) Gross: $4144, (M) Per Hour: $36.24
    (A) Employee: John, (D) Hours:12, (E) Cost: $50, (F) County: Clay, (L) Gross: $3914, (M) Per Hour: $34.91
    (A) Employee: John, (D) Hours: 34, (E) Cost: $115, (F) County: Clinton, (L) Gross: $5014, (M) Per Hour: $36.03

    Formula I prefer however seems a little more complicated:
    (aware it won't pull the same outcome for numbers)
    Gross ( L) divided by the total number of hours each employee (sum of D based on employee name in column A) multiplied by the hours per county (F) for that specific person (A). For example: John's gross is $14,634 (Sum of "L" based off name in column A) divided by his 86 total hours (sum of D based off name in column A) = $170.16, then that number multiplied by 52 (sum of the hours he worked for that specific county "F") = $8,848.47

    Sorry if this doesn't make sense

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Need Help with a sum formula based off criteria within the same tab

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Need Help with a sum formula based off criteria within the same tab

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? However, please give us an indication of the approximate number of rows of data you want the solution to work with (100, 1000, 100,000 or whatever). Please DO NOT attach a picture of an Excel sheet (I do not have the patience to re-type any/all your stuff before starting).

    1. It does NOT have to be your real sheet - mock up a SAMPLE if you need to. But not 1000's of rows!!! It makes manual checking so tedious. Whatever you do... make sure that all confidential information is removed first!!

    2. Make sure that your sample data are truly REPRESENTATIVE of your real data. For example, don't show text in a column if it's really a number. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    3. Make sure that your desired solution is also shown (mock up the results manually). To be honest, I am not interested in seeing a non-working formula... or a pile of blank cells. However, I am very interested in seeing your EXPECTED results in their EXPECTED location.

    4. Try not to use merged cells. They cause lots of problems and are DEFINITELY best avoided!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Need Help with a sum formula based off criteria within the same tab

    Try this: =SUMIF($A$1:$A$5,$K$2,$E$1:$E$5)/SUMIF($A$1:$A$5,K$2,$B$1:$B$5)*SUMIFS($B$1:$B$5,$D$1:$D$5,L$1,$A$1:$A$5,$K$2)
    I used A-F as the columns of data.
    K2 - John
    L1 - County
    Click the * to say thanks.

  5. #5
    Registered User
    Join Date
    10-03-2019
    Location
    Kansas City
    MS-Off Ver
    2016
    Posts
    5

    Re: Need Help with a sum formula based off criteria within the same tab

    Thank you everyone, I'm very new to this so let's hope I am attaching this correctly.

    The excel sheet has two tabs... one for before and one for after
    Attached Files Attached Files

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Need Help with a sum formula based off criteria within the same tab

    Can you explain how you derived ANY of the values in column M????

  7. #7
    Registered User
    Join Date
    10-03-2019
    Location
    Kansas City
    MS-Off Ver
    2016
    Posts
    5

    Re: Need Help with a sum formula based off criteria within the same tab

    I just inserted #'s in column M. They aren't actuals as I was doing a mock spreadsheet as an example.

  8. #8
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Need Help with a sum formula based off criteria within the same tab

    In M:=J2/SUMIF($A$2:$A$10,I2,$D$2:$D$10)
    in N for hours: =SUMIFS($D$2:$D$10,$A$2:$A$10,I2,$F$2:$F$10,$O$2)
    for total cost epr employee per county is: =SUMIFS($E$2:$E$10,$A$2:$A$10,I2,$F$2:$F$10,$O$2) but I didn't knew where you wanted to add the info
    O2 is the county Clay

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Need Help with a sum formula based off criteria within the same tab

    Ohhh That's really helpful in solving a logical problem. Random numbers as example solutions.

  10. #10
    Registered User
    Join Date
    10-03-2019
    Location
    Kansas City
    MS-Off Ver
    2016
    Posts
    5

    Re: Need Help with a sum formula based off criteria within the same tab

    Thank you! I will try these. I had been playing around with the SUMIF but couldn't nail it down

  11. #11
    Registered User
    Join Date
    10-03-2019
    Location
    Kansas City
    MS-Off Ver
    2016
    Posts
    5

    Re: Need Help with a sum formula based off criteria within the same tab

    My apologies... I was requesting help with that formula which is why I put random numbers. I understand your frustration. I know I could have put =J3/(D3+D6+D7+D10) however given I will have 200+ lines in the spreadsheet that will change each week I know I'll need a more complex formula that pulls it by name vs actual cell.

  12. #12
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Need Help with a sum formula based off criteria within the same tab

    You should still show the desired results on the sample workbook

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Need Help with a sum formula based off criteria within the same tab

    I spent some time trying to figure out where the values came from. I could not work it out at all. It was logical (I thought) to assume that they were a couple of manually calculated results.

    Bear that in mind next time you post a sample sheet!!

+ 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] if formula based on several criteria to extract data based on conditions
    By JEAN1972 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-17-2018, 12:46 PM
  2. [SOLVED] Formula based on criteria
    By scouse13 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-26-2017, 11:27 AM
  3. Replies: 5
    Last Post: 04-12-2016, 11:30 PM
  4. Formula to Sum based on 2 criteria
    By Ricardo9211 in forum Excel General
    Replies: 2
    Last Post: 12-28-2010, 02:09 PM
  5. If formula based on 3 criteria
    By jpruffle in forum Excel General
    Replies: 8
    Last Post: 07-14-2009, 05:47 PM
  6. Sum formula based on 2 criteria
    By hartski in forum Excel General
    Replies: 2
    Last Post: 02-21-2008, 11:48 AM
  7. Need formula based on criteria.
    By Me in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 02-06-2005, 09:06 AM

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