Formulas to pull hours and dollars based on dept type

bh24524

Active Member
Joined
Dec 11, 2008
Messages
319
Office Version
  1. 2021
  2. 2007
Hi, I have a spreadsheet that has 2 tabs. The first tab is just an overall dept. Summary tab to ideally give hour totals and dollar totals based on information that is pasted weekly in the second tab. The headers in the first tab look like this:

ABC
1Dept TypeHOURSDollars
2Warehouse Worker Regular
3Warehouse Worker Overtime
4MaintenanceN/A
5TransportationN/A
6MechanicsN/A
7Warehouse ClerksN/A
8Inventory ClerksN/A

They are only looking for hours for the Warehouse workers but they do want dollars for them and everyone else.


Tab two contains several different headers, but the ones relevant to here would be Earn Code (REG, Overtime, etc.), Hours Amount, Dollar Amount, and Position description
Here is where it gets a little tricky. Maintenance encompasses several positions, Battery Persons, Refrigeration Technicians, General Maintenance, and Parts Clerks, but they are all to be reported under one total - maintenance.

My question is can there be some kind of formula on tab 1 that will encompass the hour totals and dollar totals, and lump together what positions are within one department. What would be the best way to do this?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Could you display a sample of the 2nd sheet And, if it's not going to be obvious to people in here, show some answers you expect on the first sheet.
 
Upvote 0
Okay, so here is the sample of tab 2:

1598615717439.png



So if we look back at the 1st Tab where it has the summary, in this case, I would want the following:

*For the Maintenance category, I want to have just a dollar total for Battery Person, Maintenance Building, Refrigeration Technicians, and parts clerks. (I didn't use the exact names of those positions to the T but you get the idea) So those 4 all fall under the Maintenance category on tab 1 and I just want a combined dollar total in there.
*For the category Warehouse Worker in tab 1, that is the one where I am wanting a sum of all REG hours and the dollar amount associated with it from tab 2 - anyone who has Warehouse Worker-RP as their description. I also want the same for Overtime hours and dollars.

The maintenance and Transportation categories are the only ones that have multiple position types (Descrp column) - Maintenance has the four I mentioned and Transportation has two.

I hope this helped to clarify anything.
 
Upvote 0
If you would use XL2BB no one has to try to replicate your data. Thanks.

Also, are the hours in C and the dollars in D?
 
Last edited:
Upvote 0
Yes hours are in C and dollars in D. They have restrictions on this computer as far as downloading files so unfortunately, I can't use the XL2BB else I would.
 
Upvote 0
It appears you used it in your original post, however.
 
Upvote 0
I actually hand-typed those. I inserted blank rows and columns and bolded, numbered, and labeled them as they would normally appear in Excel. I don't know if that looks identical to how XL2BB would do it. The second I just snipped and pasted
 
Upvote 0
Does this get you started?

Book2
ABC
1Dept TypeHOURSDollars
2Warehouse Worker Regular6.33159.33
3Warehouse Worker Overtime3.46131.80
4Maintenance2282.36
5Transportation
6Mechanics
7Warehouse Clerks
8Inventory Clerks
Sheet1
Cell Formulas
RangeFormula
B2B2=SUMPRODUCT((Sheet2!$C$2:$C$100)*("Regular"=LEFT(Sheet2!$B$2:$B$100,7))*("Warehouse"=LEFT(Sheet2!$E$2:$E$100,9)))
B3B3=SUMPRODUCT((Sheet2!$C$2:$C$100)*("OT"=LEFT(Sheet2!$B$2:$B$100,2))*("Warehouse"=LEFT(Sheet2!$E$2:$E$100,9)))
C2C2=SUMPRODUCT((Sheet2!$D$2:$D$100)*("Regular"=LEFT(Sheet2!$B$2:$B$100,7))*("Warehouse"=LEFT(Sheet2!$E$2:$E$100,9)))
C3C3=SUMPRODUCT((Sheet2!$D$2:$D$100)*("OT"=LEFT(Sheet2!$B$2:$B$100,2))*("Warehouse"=LEFT(Sheet2!$E$2:$E$100,9)))
C4C4=SUMPRODUCT((Sheet2!D2:D100)*(("Battery Person"=Sheet2!E2:E100)+("Maint Bldg"=Sheet2!E2:E100)+("Refrig"=Sheet2!E2:E100)+("Parts Clerk"=Sheet2!E2:E100)))
 
Upvote 0
Yes, I do believe that will work. I am curious though if this is a situation that could alternatively utilize the SUMIFS function? I've never used Sumifs before but just thought of it now and wondered.
 
Upvote 0
I'm actually not sure about SUMIFS because you have "or" conditions in at least one of the relationship and SUMIFS is a series of "and" conditions. Maybe it would work in for the others.
 
Upvote 0

Forum statistics

Threads
1,214,588
Messages
6,120,409
Members
448,959
Latest member
camelliaCase

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top