# How to sort birthdays by month and day in Excel

Sort by the month, then by the day, and ignore the year: `=SORTBY(A2:B9,MONTH(B2:B9),1,DAY(B2:B9),1)`.

**Excel:** `=SORTBY(A2:B9,MONTH(B2:B9),1,DAY(B2:B9),1)` (Excel 2021, 2024 and Microsoft 365)

**Google Sheets:** `=SORT(A2:B9,MONTH(B2:B9),TRUE,DAY(B2:B9),TRUE)`

## Example

Sample data (row 1 is the header):

| A | B | C | D |
| --- | --- | --- | --- |
| Name | Birthday |  | By month and day |
| Ava | 1991-07-14 |  |  |
| Noah | 1985-02-03 |  |  |
| Liam | 2002-11-29 |  |  |
| Emma | 1979-02-21 |  |  |
| Sofia | 1996-09-05 |  |  |
| Lucas | 1988-01-17 |  |  |
| Mia | 2010-07-02 |  |  |
| Ethan | 1999-12-08 |  |  |

Formula in D2: `=SORTBY(A2:B9,MONTH(B2:B9),1,DAY(B2:B9),1)`

Result (spills 8 × 2): Lucas, 1/17/1988; Noah, 2/3/1985; Emma, 2/21/1979; Mia, 7/2/2010; Ava, 7/14/1991; Sofia, 9/5/1996; Liam, 11/29/2002; Ethan, 12/8/1999

## How it works

SORTBY sorts a table by arrays you calculate on the fly: first by the MONTH of each birthday, then by the DAY within the month. The year never enters the sort, so Mia, born in 2010, sorts between people born decades earlier.

Google Sheets has no SORTBY, but its SORT accepts calculated sort columns in the same way.

## Other ways

- `=SORTBY(A2:B9,TEXT(B2:B9,"mmdd"),1)`: Sorts by a single month-day code like 0117.

## Common mistakes

- Sorting the birthday column directly orders by year first, which sorts by age, not by the calendar.
- Older Excel has no SORTBY. Add a helper column `=TEXT(B2,"mmdd")` and sort the table on it.
- The result spills into D2:E9. Anything typed in that area blocks it with #SPILL!.

## Questions

**How do I show the next birthdays first?**

Sort by the days until each next birthday instead of by month.

**How do I list only one month's birthdays?**

Filter first: `=FILTER(A2:B9,MONTH(B2:B9)=11)`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/sort-birthdays-by-month-and-day
