How to sort an employee csv alphabetically by department
- Step 1Export the employee roster as CSV — BambooHR: Reports → custom report → export CSV. Workday: a worker report → export. ADP / Gusto: employee/roster report → CSV download. All export comma-delimited (auto-detected); include
Departmentand any columns you need in the output. - Step 2Drop the file onto the sorter above — The first row is read as the header and pinned to the top. The Sort by column dropdown lists your headers, so you select
Department(orTeam,Division,Cost Center) by name. - Step 3Select the Department column — Choose the department/team field. If you have several grouping columns (
Division,Department,Team), pick the level you want to group by — the sort uses one column per pass, so you sort by the broadest level you need. - Step 4Leave the Numeric checkbox OFF — this is a text sort — Department names are text, so keep Numeric sort unchecked. Alphabetic mode compares case-insensitively and accent-insensitively, and orders embedded numbers naturally (
Team 2beforeTeam 10). Ticking Numeric would strip the letters and break the sort. - Step 5Choose ascending for A→Z — Keep A → Z (ascending) for the usual alphabetical grouping (Admin, Engineering, Finance...). Use Z → A (descending) only if you specifically want reverse order.
- Step 6Sort, verify the grouping, and download — Click Sort rows. The result panel confirms
Sorted by Department · ascendingand the row count. The preview shows departments clustering together — confirm, then Download Sorted CSV (<name>.sorted-asc.csv) for org-chart review or distribution.
How the alphabetic (text) sort behaves
Alphabetic mode (Numeric off) uses locale-aware comparison: case-insensitive, accent-insensitive, with natural numeric ordering inside text. These are the behaviours that keep departments grouped correctly.
| Behaviour | Example input | Result | Why it matters for HR data |
|---|---|---|---|
| Case-insensitive | Sales, sales, SALES | All grouped together | Inconsistent capitalisation from different data-entry doesn't split a team into blocks |
| Accent-insensitive | Opérations, Operations | Sort adjacently | Accented department names group with their unaccented twins |
| Natural number order | Team 2, Team 10 | Team 2 before Team 10 | Numbered teams/regions line up the way humans read them |
| Leading whitespace | Finance vs Finance | May sort apart (space-sensitive at the front) | Trim first — leading spaces can split a department |
| Empty department | `` (blank) | Sorts to the top (ascending) | Unassigned employees cluster first — review them |
Department sort vs. things it doesn't do
The sorter groups by one text column. Filtering, splitting, and cleaning are separate tools.
| Goal | In the sorter? | Use instead |
|---|---|---|
| Group all rows by department | Yes — core function | — |
| Group by dept AND alphabetise names within | Two passes | Sort by Name first, then by Department (stable sort keeps name order within each dept) |
| Trim stray spaces splitting a department | No (never edits cells) | csv-whitespace-trimmer |
Normalise Eng vs Engineering | No | csv-find-replace to standardise labels first |
| Make one file per department | No | Sort by department, then csv-row-splitter |
| Keep only one department | No (sorting never removes rows) | csv-column-filter (Pro) |
Cookbook
Real before/after snippets from HR rosters. Employee names anonymised; the sort behaviour is exactly what the tool does.
Group employees by department, A→Z
ExampleA BambooHR export ordered by employee ID. Alphabetic ascending on Department clusters each team together.
Input (ordered by employee ID): Name,Department,Title A. Lee,Sales,AE B. Cruz,Engineering,SWE C. Patel,Finance,Analyst D. Kim,Engineering,EM Sort by: Department · A -> Z (ascending) · numeric OFF Output (departments grouped): Name,Department,Title B. Cruz,Engineering,SWE D. Kim,Engineering,EM C. Patel,Finance,Analyst A. Lee,Sales,AE
Group by department AND alphabetise names within (two passes)
ExampleThe sorter handles one column per pass, but its stable sort lets you layer two sorts. Sort by Name first, then by Department — within each department the names stay alphabetised.
Pass 1 - Sort by: Name · ascending Name,Department Anna,Engineering Ben,Sales Cara,Engineering Dan,Sales Pass 2 - Sort by: Department · ascending (stable keeps name order) Name,Department Anna,Engineering Cara,Engineering Ben,Sales Dan,Sales (departments grouped, names A->Z inside each)
Case-insensitive grouping
ExampleDifferent data-entry produced 'Sales', 'sales', and 'SALES'. The alphabetic mode folds case (sensitivity: base), so all three group together instead of forming three separate blocks.
Input: Name,Department A,sales B,Engineering C,SALES D,Sales Sort by: Department · ascending · numeric OFF Output (all Sales variants together): Name,Department B,Engineering A,sales C,SALES D,Sales (the original casing is preserved in each cell)
Natural number ordering for numbered teams
ExampleTeams named Team 1..Team 10. A naive sort would put Team 10 before Team 2. This tool's alphabetic mode uses natural number ordering, so Team 2 comes before Team 10.
Input: Name,Team A,Team 10 B,Team 2 C,Team 1 Sort by: Team · ascending · numeric OFF Output (natural order): Name,Team C,Team 1 B,Team 2 A,Team 10 (Numeric checkbox stays OFF - the text mode handles the numbers)
Stray leading space splits a department — trim first
ExampleTwo employees have ' Finance' (leading space) while others have 'Finance'. The leading space sorts them apart, splitting the department. Trim whitespace first, then sort.
Input (note the leading space on rows A, C): Name,Department A, Finance B,Finance C, Finance Direct sort splits Finance into two blocks. Step 1 - csv-whitespace-trimmer (removes leading/trailing spaces) Step 2 - csv-sorter: Department · ascending Output: all four Finance rows in one contiguous block.
Errors and edge cases
Real errors and silent failures sourced from each platform's own documentation. Match the wording to the row, fix what the row says to fix.
Inconsistent labels (`Eng` vs `Engineering`)
Fails to groupThe sorter groups by exact text (case/accent aside), so Eng, Engineering, and Engineering Dept are three different departments and sort into three separate blocks. The tool can't know they're the same team. Standardise the labels first with csv-find-replace, then sort — then every Engineering employee lands in one block.
Leading/trailing spaces in department names
Fails to group Finance (leading space) and Finance sort apart because the comparison is space-sensitive at the start of the string — splitting one department into two blocks. The sorter never edits cells, so run csv-whitespace-trimmer first to remove the stray spaces, then sort.
Mixed case across data-entry sources
Grouped togetherSales, sales, and SALES all group together — the alphabetic mode compares case-insensitively (sensitivity: base). The original casing is preserved in each cell; only the comparison folds case. So inconsistent capitalisation doesn't split a team, which is the desired behaviour.
Accented department names
Grouped togetherOpérations and Operations sort adjacently because the comparison is accent-insensitive at base sensitivity. Accented and unaccented variants of the same department name don't split into separate blocks. As with case, the original accented text is preserved in the output.
Numbered teams (`Team 2` vs `Team 10`)
Natural orderAlphabetic mode uses natural numeric ordering inside text, so Team 2 sorts before Team 10 (not after, as a plain string sort would do). Keep the Numeric checkbox off — the text mode already handles the embedded numbers. Ticking Numeric would strip the word Team entirely and break the sort.
Empty / unassigned department
Grouped at topEmployees with a blank department cell sort to the top in ascending order (empty string sorts first). This conveniently clusters unassigned staff for review. The rows are preserved, never dropped. To exclude them, filter out blanks with csv-column-filter first.
Within-department order looks random
By designSorting by Department alone groups departments but leaves employees in whatever order they had inside each group (the sort is stable, so it's the input order). To alphabetise names within each department, do two passes: sort by Name first, then by Department. The stable sort preserves the name order within each department block.
Numeric checkbox accidentally ticked
Sort failsIf Numeric sort is on for a text department column, numeric mode strips all the letters, leaving an empty string for Engineering, Finance, etc. — so every row parses to 0 and the sort does nothing useful (rows stay in input order). For department names, always leave Numeric off.
More than 500 rows on the free tier
Rejected (limit)Free sorts up to 500 result rows; a large company roster is blocked after parsing with a row-count message. Pro raises the limit to 100,000 rows. On free, sort one division at a time after filtering with csv-column-filter, or split with csv-row-splitter.
File over 2 MB on the free tier
Rejected (limit)A full roster with many columns can exceed 2 MB; the free tier blocks before sorting and shows a Pro overlay. Pro lifts the cap to 100 MB. Remove columns you don't need (salary, address) with csv-column-remover to shrink the file, or upgrade.
Frequently asked questions
How do I group my employee list by department?
Drop the file on the sorter, pick the Department column, leave the Numeric checkbox off (department names are text), keep A → Z (ascending), and click Sort rows. Every department clusters together alphabetically. Download as .sorted-asc.csv for org-chart review or distribution.
Will 'Sales' and 'sales' end up in the same group?
Yes. The alphabetic mode compares case-insensitively (base sensitivity), so Sales, sales, and SALES all group together instead of forming separate blocks. The original casing is kept in each cell — only the comparison folds case.
Do accented department names like 'Opérations' sort correctly?
Yes. The comparison is accent-insensitive at base sensitivity, so Opérations and Operations sort adjacently and don't split into two blocks. The accented text is preserved in the output.
Why does 'Team 10' come after 'Team 2' — isn't that backwards for text?
It's correct, and intentional. The alphabetic mode uses natural numeric ordering, so embedded numbers sort by value: Team 2 before Team 10. Keep the Numeric checkbox off — the text mode already handles the numbers. (A plain byte sort would wrongly put Team 10 first.)
How do I group by department AND alphabetise employees within each one?
Use two passes. First sort by the Name column (ascending), then sort by Department. Because the sort is stable, the name order is preserved within each department block. The key is order: sort the within-group key (Name) first, then the grouping key (Department).
My department is split into two blocks — what happened?
Usually a stray leading/trailing space ( Finance vs Finance) or an inconsistent label (Eng vs Engineering). The sorter groups by exact text. Trim spaces with csv-whitespace-trimmer or standardise labels with csv-find-replace first, then sort.
Should I ever tick the Numeric checkbox for department names?
No. Numeric mode strips all letters, leaving Engineering/Finance as empty strings (every row → 0), so the sort does nothing useful. Leave Numeric off for any text column. It's only for number columns like salary or headcount.
Will sorting change names, titles, or salaries?
No. The sorter only reorders rows — it never edits a cell. Names, titles, salaries, and ID fields come out byte-identical, just regrouped by department. The header row stays pinned at the top.
How do I make one CSV per department?
Sort by Department first so each team is contiguous, then use csv-row-splitter to split the file. Alternatively, filter to a single department with csv-column-filter (Pro) and export each one separately.
Is employee PII uploaded anywhere?
No. Parsing and sorting run entirely in your browser via PapaParse — names, salaries, and ID/SSN fields never reach a server. When signed in, only a usage counter is stored (no content). This matters for HR data under GDPR/CCPA.
How large a roster can I sort for free?
Free handles up to 2 MB and 500 rows per job. Pro raises that to 100 MB and 100,000 rows. On free, filter to one division with csv-column-filter or remove columns with csv-column-remover to fit, or upgrade for the full roster.
Can I sort by department then by salary within each department?
Yes, with two passes. Sort by Salary first (tick Numeric — salary is a number), then sort by Department (Numeric off — text). The stable sort keeps the salary order within each department. Sort the within-group key first, the grouping key second.
Privacy first
Processing runs locally in your browser with PapaParse. No file is uploaded — only metadata counters are saved for signed-in dashboard stats.