I hate to keep asking for help, but I can't get this on my own. :-(

TAPS_MikeDion

Well-known Member
Joined
Aug 14, 2009
Messages
622
Office Version
  1. 2011
Platform
  1. MacOS
Hi all,

I have a TOTALS sheet that needs to pull data from several sheets and I just can't seem to get this right. Sorry, I wish I could get this on my own, but I'm stumped. I'm thinking this is going to be a VBA project.

Here are the sheets in the workbook (table examples are below):
  • EMPLOYEES
    • 2 Columns: First Name, Last Name
    • Up to 75 rows
  • LOCRATE
    • 3 Columns: Location Name, Location Abbrev (3-letters), Pay Rate
    • # of rows are based on however many locations
  • 17 (3-letter) Location sheets (i.e BGE, PAH, PDD, and so on)
    • Each location sheet has the employees names (linked to from the EMPLOYEES sheet)
    • 34 Columns: Last Name, First Name, WAL (Works At Location), 1-31 (Days of the month)
    • Up to 75 rows (# of employees)
  • SUMMARY
  • Employees names (linked to from the EMPLOYEES sheet)
    • 20 Columns: Last Name, First Name, Fixed Pay, 17 location sheet names
    • Up to 75 rows (# of employees)
  • TOTALS
    • Here's where I'm having the trouble
    • Employees names (linked to from the EMPLOYEES sheet)
    • 8 Columns: Last Name (A), First Name (B), Location (C), Location Hourly Rate (D), Hours Worked (E), Total Hours Worked (F), Pay (G)
    • # of rows will always vary
In the TOTALS sheet:
  • I need to search through all rows in the SUMMARYsheet...
    • Put the employee names from the SUMMARY sheet columns A & B in the TOTALS sheet columns A & B
    • Going down the rows in the SUMMARYsheet for each employee
      • Find every occurence of an hours total in a location column of the SUMMARY sheet
      • If hours were found in any location column
        • Look in the LOCRATE sheet for the "Location Name"
          • Find the matching the 3-letter code in LOCRATE column B that matches the SUMMARY sheet location column 3-letter name
          • Using that row in the LOCRATE sheet...
          • Put column A data (location name) in column C of the TOTALS sheet
          • Put column C data (Pay Rate) in column D of the TOTALS sheet
      • Put the hours worked total from the SUMMARY sheet into column E
      • When all SUMMARY sheet location columns (17 columns) have been gone through, then...
  • Column F in the TOTALS sheet needs to total up all column E entries for that employee
  • Column G then calculates the "Pay"...
    • Going down the rows for that employee
      • Multiply column D & column E amounts

Hopefully looking at the table3s makes it easier to follow.

EMPLOYEES sheet
LAST NAMEFIRST NAME
DoeJane
WestTom
GatesBill


LOCRATE sheet
LOCATION NAMELOCATION ABBREVPAY RATE
Willy Wonka's Chocolate FactoryWWC15
Joe's Window WashJWW12


WWC (3-Letter Location) sheet (only went from day 1 to 5 to keep it short)
WAL = Works At Location
Employee 1 worked 24 hours at this location from the 1st to the 3rd of the month
Employee 2 does not work at this location
Employee 3 worked 16 hours at this location from the 4th to the 5th of the month
LAST NAMEFIRST NAMEWAL12345
=employee sheet A2=employee sheet B2x888
=employee sheet A3=employee sheet B3
=employee sheet A4=employee sheet B4x88


JWW (3-Letter Location) sheet (only went from day 1 to 5 to keep it short)
WAL = Works At Location
Employee 1 does not work at this location
Employee 2 worked 24 hours at this location on the 1st, 3rd and 5th of the month
Employee 3 worked 16 hours at this location on the 2nd & 4th of the month
LAST NAMEFIRST NAMEWAL12345
=employee sheet A2=employee sheet B2
=employee sheet A3=employee sheet B3x888
=employee sheet A4=employee sheet B4x88


SUMMARY sheet
For argument sake (Tom West - employee sheet A3) is on fixed pay - that can be disregarded in any code written.
LAST NAMEFIRST NAMEFIXED PAYWWCJWWETC
=employee sheet A2=employee sheet B224
=employee sheet A3=employee sheet B3x24
=employee sheet A4=employee sheet B41616


TOTALS sheet
Using the information pulled in from the other sheets of the workbook...
Columns F & G in the 4th line are just empty cells since the TOTAL HOURS WORKED & PAY are filled in at the bottom of Bill Gates' rows of info.
LAST NAMEFIRST NAMELOCATIONLOCATION HOURLY RATEHOURS WORKEDTOTAL HOURS WORKEDPAY
DoeJaneWilly Wonka's Chocolate Factory152424$360.00
WestTomJoe's Window Wash122424$288.00
GatesBillWilly Wonka's Chocolate Factory1516LEAVE BLANK - NO DATALEAVE BLANK - NO DATA
GatesBillJoe's Window Wash121632$432.00 (240+192)



Hopefully this is enough info and not too confusing for whomever agrees to help me out on this.

THANK YOU IN ADVANCE!!!

I know this is a lot to ask for, but I don't know enough about VBA to do this one on my own.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
I have no idea how to do this in VBA. But when I see a host of tables like this, I think Power Query. You should be able to use PQ to load and transform all the data into the final table on your TOTALS sheet.

Also, anyone wanting to help with this would probably want some better sample data together with expected outcome. Can you provide more detailed sample data? It can be uploaded using XL2Bb [see signature below].
 
Upvote 0
Hi, If you can share this workbook, without data, I'm sure I can help you, I have create several Payroll sheets, very complicate with a big lot of customization.

Or put every sheet using add-in specifically for this and it can be found here XL2BB
 
Upvote 0
Sorry for the delay, it's been a busy weekend.

Having trouble with trying Power Query and XL2BB, because I'm running on a Mac (can't get the boss to buy me a PC instead.)
However, I'm going to try to share the workbook without data later today.
 
Upvote 0
Work delay... as soon as I can try sharing the workbook, I will post again.

Thanks!
 
Upvote 0
Hi Mike,
I have the file in Dropbox, but from what I'm seeing I need your email address in order to share the file, unless I'm supposed to share it some other way on MrExcel.
 
Upvote 0
Hi put a link here, I download this inmediatly
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,256
Messages
6,123,915
Members
449,132
Latest member
Rosie14

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