Merge "like rows" and sum the "Total Hours" value

Clooney

New Member
Joined
Sep 28, 2012
Messages
41
Office Version
  1. 365
Platform
  1. Windows
So I have this data set that I use weekly for my employees. No idea why this is happening but it is now splitting the "Regular" Pay Code column up and its wreaking havoc with a company wide spreadsheet.

What I want to do is merge the employees who have these 2 "Regular" Pay Code rows merged into one row and have the Actual Total hours column summed but leave the rest of the list intact. Hopefully my image shows better at what I am trying to explain.
 

Attachments

  • 2022-08-02 14_29_57-2W Payroll 07312022.xls - Excel.png
    2022-08-02 14_29_57-2W Payroll 07312022.xls - Excel.png
    55.2 KB · Views: 10

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
So I have this data set that I use weekly for my employees. No idea why this is happening but it is now splitting the "Regular" Pay Code column up and its wreaking havoc with a company wide spreadsheet.

What I want to do is merge the employees who have these 2 "Regular" Pay Code rows merged into one row and have the Actual Total hours column summed but leave the rest of the list intact. Hopefully my image shows better at what I am trying to explain.
You didn't mention the excel version and platform you are using - That shall effect how your intended result can be achieved.

You can update same in your profile or at least mention it here to help you better.
 
Upvote 0
You didn't mention the excel version and platform you are using - That shall effect how your intended result can be achieved.

You can update same in your profile or at least mention it here to help you better.
Sorry, Office 365 on PC. I havent been online since this site updated so it looks like all of my personal info was wiped. I will update it again.
 
Upvote 0
Sorry, Office 365 on PC. I havent been online since this site updated so it looks like all of my personal info was wiped. I will update it again.
then it's really easy

use UNIQUE function to get EmloyeeFullName in cell (example M1)
Pull rest of the data using XLOOKUP Function referencing Cell (M1#) # helps to propagate formula across spill

for Actual total use SUMIFS Function

Hope this helps
Best wishes
 
Upvote 0
then it's really easy

use UNIQUE function to get EmloyeeFullName in cell (example M1)
Pull rest of the data using XLOOKUP Function referencing Cell (M1#) # helps to propagate formula across spill

for Actual total use SUMIFS Function

Hope this helps
Best wishes
There is a glitch in it - I just saw that in your data Employees have different types of Paycode

In that case you can have such a structure

All Records.xlsb
ABCDEFGHIJKL
1Raw DataResult
2NameIDPayCodeHoursNameIDRegularOtherOvertimePayCode
3Employee 01XYZRegular34Employee 01XYZ732010Regular
4Employee 02LMNRegular24Employee 02LMN2400Other
5Employee 03QRSTOther8Employee 03QRST080Overtime
6Employee 04XYZROther38Employee 04XYZR0380
7Employee 05ABCDOther35Employee 05ABCD0350
8Employee 06EFGHOther34Employee 06EFGH0340
9Employee 07TRYRegular17Employee 07TRY431015
10Employee 07TRYOther10Employee 08HI0370
11Employee 08HIOther37Employee 09GIVE0220
12Employee 09GIVEOther22Employee 10ANOTHER0210
13Employee 10ANOTHEROther21Employee 11TRY0220
14Employee 11TRYOther22
15Employee 01XYZRegular39
16Employee 07TRYRegular26
17Employee 01XYZOvertime10
18Employee 07TRYOvertime15
19Employee 01XYZOther20
Example
Cell Formulas
RangeFormula
H2:J2H2=TRANSPOSE(L3#)
F3:F13F3=UNIQUE(A3:A16)
G3:G13G3=XLOOKUP($F3#,A3:A16,B3:B16)
H3:J13H3=SUMIFS($D$3:$D$19,$A$3:$A$19,$F3#,$C$3:$C$19,H$2)
L3:L5L3=UNIQUE(C3:C18)
D3:D9,D11:D16D3=RANDBETWEEN(1,40)
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C3:D16Expression=$C3="Regular"textNO
 
Upvote 0
Sorry, Office 365 on PC. I havent been online since this site updated so it looks like all of my personal info was wiped. I will update it again.
Check This

All Records.xlsb
ABCDEFGHIJ
1Raw DataResult
2NameIDPayCodeHoursNameIDRegularOtherOvertime
3Employee 01XYZRegular34Employee 01XYZ732010
4Employee 02LMNRegular24Employee 02LMN2400
5Employee 03QRSTOther8Employee 03QRST080
6Employee 04XYZROther38Employee 04XYZR0380
7Employee 05ABCDOther35Employee 05ABCD0350
8Employee 06EFGHOther34Employee 06EFGH0340
9Employee 07TESTRegular17Employee 07TEST431015
10Employee 07TESTOther10Employee 08HI0370
11Employee 08HIOther37Employee 09GIVE0220
12Employee 09GIVEOther22Employee 10ANOTHER0210
13Employee 10ANOTHEROther21Employee 11TRY0220
14Employee 11TRYOther22
15Employee 01XYZRegular39
16Employee 07TESTRegular26
17Employee 01XYZOvertime10
18Employee 07TESTOvertime15
19Employee 01XYZOther20
Example
Cell Formulas
RangeFormula
H2:J2H2=TRANSPOSE(UNIQUE(C3:C18))
F3:F13F3=UNIQUE(A3:A16)
G3:G13G3=XLOOKUP($F3#,A3:A16,B3:B16)
H3:J13H3=SUMIFS($D$3:$D$19,$A$3:$A$19,$F3#,$C$3:$C$19,H$2)
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C3:D16Expression=$C3="Regular"textNO
 
Upvote 0
Check This

All Records.xlsb
ABCDEFGHIJ
1Raw DataResult
2NameIDPayCodeHoursNameIDRegularOtherOvertime
3Employee 01XYZRegular34Employee 01XYZ732010
4Employee 02LMNRegular24Employee 02LMN2400
5Employee 03QRSTOther8Employee 03QRST080
6Employee 04XYZROther38Employee 04XYZR0380
7Employee 05ABCDOther35Employee 05ABCD0350
8Employee 06EFGHOther34Employee 06EFGH0340
9Employee 07TESTRegular17Employee 07TEST431015
10Employee 07TESTOther10Employee 08HI0370
11Employee 08HIOther37Employee 09GIVE0220
12Employee 09GIVEOther22Employee 10ANOTHER0210
13Employee 10ANOTHEROther21Employee 11TRY0220
14Employee 11TRYOther22
15Employee 01XYZRegular39
16Employee 07TESTRegular26
17Employee 01XYZOvertime10
18Employee 07TESTOvertime15
19Employee 01XYZOther20
Example
Cell Formulas
RangeFormula
H2:J2H2=TRANSPOSE(UNIQUE(C3:C18))
F3:F13F3=UNIQUE(A3:A16)
G3:G13G3=XLOOKUP($F3#,A3:A16,B3:B16)
H3:J13H3=SUMIFS($D$3:$D$19,$A$3:$A$19,$F3#,$C$3:$C$19,H$2)
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C3:D16Expression=$C3="Regular"textNO
That's definitely a start. I can actually use this as a set of helper columns. I will dig into this in the morning.

Thank you so much. I will reply with my findings.
 
Upvote 0
That's a wonderful solution, if I could change our corporate sheet to this, it would save a huge headache but unfortunately they keep it locked down and there is a lot of red tape that has to happen in order to make the change.

So with everything basically transposed I need the data transposed back into a "Paycode" column just using the "Regular" and "Overtime" hours to where if an employee has both Regular and Overtime hours their name and ID will appear twice in the list.

2W Payroll 07312022.xls
ABCDEFG
10Employee Full NameEmployee IDPositionCustom FieldPay CodeShiftActual Total Hours (Include Corrections)
11Ashley, Adam M2645Regular130-1-Lebanon $0.040
12Ashley, Elizabeth17933Overtime130-1-Lebanon $0.03.17
13Ashley, Elizabeth17933Regular130-1-Lebanon $0.032
14Baker, Ann M18933Overtime130-3-Lebanon $1.08.08
15Baker, Ann M18933Regular130-3-Lebanon $1.030
16Baker, Jerry L10411Regular130-1-Lebanon $0.040
17Bills, Leon19418Overtime130-1-Lebanon $0.010.97
18Bills, Leon19418Regular130-1-Lebanon $0.040
19Boula, Jean-Claude E10438Overtime130-1-Lebanon $0.010.43
20Boula, Jean-Claude E10438Regular130-1-Lebanon $0.040
21Boyer, Homer W21538Overtime130-2-Lebanon $1.03.47
22Boyer, Homer W21538Regular130-2-Lebanon $1.040
23Broach, Allison R21361Overtime130-1-Lebanon $0.015.63
24Broach, Allison R21361Regular130-1-Lebanon $0.040
Sheet1
 
Upvote 0
Try this :

Book4
ABCDEFGHIJKLMNO
1Raw DataResult
2Employee Full NameEmployee IDPositionCustom FieldPay CodeShiftActual Total Hours (Include Corrections)Employee Full NameEmployee IDPositionCustom FieldPay CodeShiftActual Total Hours (Include Corrections)
3Ashley, Adam M2645Regular130-1-Lebanon $0.032Ashley, Adam M264500Regular130-1-Lebanon $0.040.00
4Ashley, Adam M2645RegularSemi-Mon8Ashley, Elizabeth1793300Overtime130-1-Lebanon $0.03.17
5Ashley, Elizabeth17933Overtime130-1-Lebanon $0.03.17Ashley, Elizabeth1793300Personal U130-1-Lebanon $0.08.00
6Ashley, Elizabeth17933Personal U130-1-Lebanon $0.08Ashley, Elizabeth1793300Regular130-1-Lebanon $0.032.00
7Ashley, Elizabeth17933Regular130-1-Lebanon $0.032Ayers, Larry D21384WAREASSOC0Termination1-
8Ayers, Larry D21384WAREASSOCTermination10Baker, Ann M1893300Overtime130-3-Lebanon $1.08.08
9Baker, Ann M18933Overtime130-3-Lebanon $1.08.08Baker, Ann M1893300Regular130-3-Lebanon $1.040.00
10Baker, Ann M18933Regular130-3-Lebanon $1.08Baker, Jerry L1041100Regular130-1-Lebanon $0.040.00
11Baker, Ann M18933Regular130-3-Lebanon $1.022.97Bills, Leon1941800Overtime130-1-Lebanon $0.010.97
12Baker, Ann M18933Regular19.03Bills, Leon1941800Regular130-1-Lebanon $0.040.00
13Baker, Jerry L10411Regular130-1-Lebanon $0.040Boula, Jean-Claude E1043800Overtime130-1-Lebanon $0.010.43
14Bills, Leon19418Overtime130-1-Lebanon $0.010.97Boula, Jean-Claude E1043800Regular130-1-Lebanon $0.040.00
15Bills, Leon19418Regular130-1-Lebanon $0.040Boyer, Homer W2153800Overtime130-2-Lebanon $1.03.47
16Boula, Jean-Claude E10438Overtime130-1-Lebanon $0.010.43Boyer, Homer W2153800Regular130-2-Lebanon $1.040.00
17Boula, Jean-Claude E10438Regular130-1-Lebanon $0.040Broach, Allison R2136100Overtime130-1-Lebanon $0.015.63
18Boyer, Homer W21538Overtime130-2-Lebanon $1.03.47Broach, Allison R2136100Regular130-1-Lebanon $0.040.00
19Boyer, Homer W21538Regular130-2-Lebanon $1.040 
20Broach, Allison R21361Overtime130-1-Lebanon $0.015.63
21Broach, Allison R21361Regular130-1-Lebanon $0.040
Sheet1
Cell Formulas
RangeFormula
I2:O2I2=A2:G2
I3:M18I3=UNIQUE(A3:E21)
N3:N19N3=IF(I3<>"",XLOOKUP(I3&"!"&M3,A$3:A$21&"!"&E$3:E$21,F$3:F$21),"")
O3:O19O3=IF(I3<>"",SUMIFS(G$3:G$21,A$3:A$21,I3,E$3:E$21,M3),"")
Dynamic array formulas.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,436
Messages
6,124,869
Members
449,192
Latest member
MoonDancer

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