A practical way to stack workbooks whose columns are not in the same order, drop a row that was exported twice, and split the result into one file per department.
HR and finance files rarely line up. One workbook has Name, EmpNo, Dept, Hours. The next CSV has Dept first and a Note column the others lack. Copying blocks under each other by column letter puts a department name into the hours column.
The useful question is: which cells share a header, which row is a duplicate, and what do the hours add up to after that row is removed? The same finished table can then be split into one file per department.
Three files for the same week. Employee numbers are text, so a leading zero has to survive. Hours are ordinary numbers.
| Name | EmpNo | Dept | Hours |
|---|---|---|---|
| Ada | 00128 | East | 40 |
| Ben | 00129 | East | 38 |
| Dept | EmpNo | Name | Hours |
|---|---|---|---|
| West | 00130 | Cara | 36 |
| West | 00132 | Eve | 40 |
| Name | EmpNo | Hours | Dept | Note |
|---|---|---|---|---|
| Ada | 00128 | 40 | East | duplicate export |
| Dan | 00131 | 42 | East |
If you paste West.xlsx under East.xlsx without looking at headers, West’s first column (Dept) lands under Name, and the hours land under Dept. Cara’s 36 hours is no longer in the Hours column. Matching by header name avoids that. Dept stays Dept even when it is column A in one file and column D in another.
Two honest choices:
Use the union when the extra column matters. Use the first file when you have already agreed a column list and later files must conform to it.
Six data rows before any cleanup. Blank rows are ignored and are not part of this count.
East: 40 + 38 = 78
West: 36 + 40 = 76
CSV: 40 + 42 = 82
78 + 76 + 82 = 236 hours across 6 rows
Ada, employee 00128, East, 40 hours, is in East.xlsx and again in the CSV. That is one person exported twice, not two weeks. Keep the first row and drop the copy. The employee number stays 00128, not 128.
236 − 40 = 196 hours
6 − 1 = 5 people
| Name | EmpNo | Dept | Hours | Note |
|---|---|---|---|---|
| Ada | 00128 | East | 40 | |
| Ben | 00129 | East | 38 | |
| Cara | 00130 | West | 36 | |
| Eve | 00132 | West | 40 | |
| Dan | 00131 | East | 42 | |
| Total | 196 | |||
40 + 38 + 36 + 40 + 42 = 196. If a later week really does contain Ada again, with different hours, that row is not this kind of duplicate. Deduplicate only on the columns that mean “this is the same line”, not on the name alone.
Each distinct Dept becomes a file. The file name is the cell value.
| File | Rows | Hours |
|---|---|---|
| East.xlsx (Ada, Ben, Dan) | 3 | 120 |
| West.xlsx (Cara, Eve) | 2 | 76 |
| Total | 5 | 196 |
120 + 76 = 196, the same hours you had before the split. A department value that cannot be a file name, such as a slash, is written with an underscore instead. This example does not need that: East and West are already safe names.
00128 and 128 are not the same employee number once a leading zero has been stripped..xls files, password-protected workbooks, and macros are not part of this job.Three small files are a calculator exercise. A year of department CSV exports is not. Excel CSV Merge & Split is a Windows desktop app for this exact pair of jobs:
Free download. Up to 3 files and 500 rows. $9.99 one-time removes both limits. This example fits in the free version.
Get Excel CSV Merge & Split on Microsoft StoreLine the cells up by header name. Dept in column A and Dept in column D are the same column. Pasting by column letter is what moves the hours.
First-file headers keep Name, EmpNo, Dept, and Hours, and drop Note. The union keeps Note as well, with blank cells in the files that did not have it.
Remove the repeated row before you add the hours. 236 − 40 = 196, and 6 rows become 5. Do not treat a later week with different hours as this kind of duplicate.
Group by the Dept column. East has 3 rows and 120 hours, West has 2 rows and 76 hours, and 120 + 76 = 196.
Yes. Excel CSV Merge & Split merges by headers or splits by a column, including GBK CSV, and keeps leading zeros. Free for up to 3 files and 500 rows. $9.99 one-time removes those limits. Files stay on your PC.