Excel CSV Merge & Split › Guides

How to Merge Excel and CSV Files by Column Headers

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.

The problem: several files, one table

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.

A worked example

Three files for the same week. Employee numbers are text, so a leading zero has to survive. Hours are ordinary numbers.

East.xlsx — headers in this order

NameEmpNoDeptHours
Ada00128East40
Ben00129East38

West.xlsx — department is the first column

DeptEmpNoNameHours
West00130Cara36
West00132Eve40

East-again.csv — Ada’s row was exported twice, plus Dan and a Note

NameEmpNoHoursDeptNote
Ada0012840Eastduplicate export
Dan0013142East

Step 1: Add the files the wrong way, by position

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.

Step 2: Choose which headers to keep

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.

Step 3: Count rows and hours, then drop the duplicate

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

NameEmpNoDeptHoursNote
Ada00128East40
Ben00129East38
Cara00130West36
Eve00132West40
Dan00131East42
Total196

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.

Step 4: Split the five rows by department

Each distinct Dept becomes a file. The file name is the cell value.

FileRowsHours
East.xlsx (Ada, Ben, Dan)3120
West.xlsx (Cara, Eve)276
Total5196

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.

Tips for a merge you can audit

Let Excel CSV Merge & Split do the stack

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 Store

FAQ

How do I merge Excel files whose columns are in a different order?

Line 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.

What is the difference between first-file headers and the union of headers?

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.

How do I stop a merged sheet from double-counting a row?

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.

How do I split one sheet into a file per department?

Group by the Dept column. East has 3 rows and 120 hours, West has 2 rows and 76 hours, and 120 + 76 = 196.

Is there a free Windows app that merges and splits Excel and CSV files offline?

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.