Month and Year From a Date in Excel — With Examples (TEXT, MONTH, YEAR, EOMONTH)
Learn how to get the month and year from a date in Excel: month name, month number, quarter, first and last day...
Read Guide →Your column says “David Lee” and you need “David” in one column and “Lee” in another. Or “David Lee Carter” and you need all three parts. The fastest way is TEXTSPLIT — one formula, =TEXTSPLIT(A2, " "), and the parts spill across the columns. The way that works in every version is two formulas: =LEFT(A2, FIND(" ", A2) - 1) for the first name and =RIGHT(A2, LEN(A2) - FIND(" ", A2)) for the last name. This guide gives you both, then runs them on the same six names, so you can check each answer yourself — plus the middle name, the “Last, First” format, and the names that break the simple formulas.
Quick takeaway: FIND gives the position; LEFT and RIGHT cut at it.
=LEFT(A2, FIND(" ", A2) - 1) — everything before the first space.=RIGHT(A2, LEN(A2) - FIND(" ", A2)) — everything after the first space.=TEXTSPLIT(A2, " ") — one formula, all the parts.
=LEFT(A2, FIND(" ", A2) - 1)
=RIGHT(A2, LEN(A2) - FIND(" ", A2))
FIND returns the position of the space. LEFT takes everything before it; RIGHT takes everything after it. Work it by hand on “David Lee”: FIND(” “, “David Lee”) is 6, because the space is the 6th character. LEFT takes 6 − 1 = 5 characters — “David”. LEN is 9, so RIGHT takes 9 − 6 = 3 characters from the end — “Lee”. In Microsoft 365 the same two results are shorter: =TEXTBEFORE(A2, " ") gives the first name and =TEXTAFTER(A2, " ") gives the last name — but only in Microsoft 365 and Excel 2024.
Every example below uses the same six names. Every result was checked against them.
| Full name in A2 | First name | Last name (simple formula) | Last word | Middle name |
|---|---|---|---|---|
| David Lee | David | Lee | Lee | — |
| Sara Ahmed | Sara | Ahmed | Ahmed | — |
| David Lee Carter | David | Lee Carter | Carter | Lee |
| Mary Ann O’Brien | Mary | Ann O’Brien | O’Brien | Ann |
| John Michael Doe | John | Michael Doe | Doe | Michael |
| Carter, David | Carter, | David | David | — |
Read the rows. On the two-part names the simple formulas are right. On the three-part names they are not: the simple last-name formula gives “Lee Carter” for “David Lee Carter” — everything after the first space, which is two words, not one. That is the trap. The last-word column is the fix: it gives “Carter”, “O’Brien” and “Doe” — the real last names. And the “Carter, David” row shows the other trap: the first-name formula gives “Carter,” with the comma still attached, because it cuts at the space, not the comma.
For a three-part name, the middle name sits between the first space and the second space:
=MID(A2, FIND(" ", A2) + 1, FIND(" ", A2, FIND(" ", A2) + 1) - FIND(" ", A2) - 1)
Work it by hand on “David Lee Carter”: the first space is at 6, the second space is at 10. MID starts at 6 + 1 = 7 and takes 10 − 6 − 1 = 3 characters — “Lee”. And only run it when there is a middle name to find: count the spaces first — LEN minus LEN of the text without spaces. =LEN(A2) - LEN(SUBSTITUTE(A2, " ", "")) is 2 for “David Lee Carter” and 1 for “David Lee”. Wrap the MID in IF so a two-part name stays blank:
=IF(LEN(A2) - LEN(SUBSTITUTE(A2, " ", "")) = 2, MID(A2, FIND(" ", A2) + 1, FIND(" ", A2, FIND(" ", A2) + 1) - FIND(" ", A2) - 1), "")
When a name has three parts, or four, the last name is the last word — and this formula finds it however many words there are:
=TRIM(RIGHT(SUBSTITUTE(A2, " ", REPT(" ", 50)), 50))
SUBSTITUTE replaces each space with 50 spaces, RIGHT takes the last 50 characters, and TRIM removes the extra spaces, leaving only the last word. On the table it gives “Carter”, “O’Brien” and “Doe” — the same answers as the last-word column. Use it whenever you only want the last word and you do not know how many words the cell holds.
Some lists are written “Carter, David” — last name first, with a comma. Split at the comma, not the space:
| Part | Formula | Result on “Carter, David” |
|---|---|---|
| Last name | =LEFT(A2, FIND(",", A2) - 1) | Carter |
| First name | =RIGHT(A2, LEN(A2) - FIND(",", A2) - 1) | David |
In Microsoft 365 the same pair is =TEXTBEFORE(A2, ", ") and =TEXTAFTER(A2, ", ") — the delimiter is comma-plus-space, so the space is gone from both results. With the LEFT/RIGHT version, the −1 in the first-name formula skips the space after the comma. And watch the order: the first column of the result is the last name here, not the first — swap the two columns if your list needs first name first.
=TEXTSPLIT(A2, " ")
TEXTSPLIT splits a cell at every separator and spills the parts into the next cells. “John Michael Doe” becomes John | Michael | Doe across three columns. Use several separators at once with an array, such as =TEXTSPLIT(A2, {",", ";"}). To split into rows instead of columns, use the row delimiter: =TEXTSPLIT(A2, , ", ") splits into rows. Two warnings: TEXTSPLIT needs free cells to spill into — if a cell in the way is not empty, Excel gives #SPILL! — and it is Microsoft 365 and Excel 2024 only, so the LEFT/RIGHT formulas are the ones to use in older Excel.
Text to Columns is fastest for a one-time split: select the cells, go to Data > Text to Columns, choose Delimited, tick the separator (Space, Comma, or type one in Other), set the Destination to an empty cell so nothing is overwritten, then click Finish. The result is static — it does not update when the source changes.
Flash Fill learns from one example: type the first name of the first row next to the full names — for example “Amit” — then press Ctrl+E, and Excel fills the rest. It is available from Excel 2013 and works well for clean, consistent data. Always scan the result, because it guesses the pattern and can be wrong when rows differ, such as names with a middle name. Like Text to Columns, the result is static.
| Mistake | What happens | Fix |
|---|---|---|
| You used the simple last-name formula on a three-part name | “Lee Carter” instead of “Carter” | Use the last-word formula |
| You split “Carter, David” at the space | “Carter,” with the comma attached | Split at the comma |
| You used TEXTSPLIT in old Excel | #NAME? — the function does not exist there | Use LEFT/RIGHT with FIND |
| You forgot the spill space | #SPILL! — a cell in the way is not empty | Clear the cells to the right |
| You used FIND on a name with no space | #VALUE! — FIND returns an error when the space is not there | Wrap it in IFERROR: =IFERROR(LEFT(A2, FIND(" ", A2) - 1), A2) |
| You split a code with a leading zero | 0412 becomes 412 | Set the column to Text format before splitting |
| You trusted Flash Fill on mixed names | Middle names land in the wrong column | Scan the result, or use formulas |
How do I split first and last name in Excel? =LEFT(A2, FIND(" ", A2) - 1) for the first name and =RIGHT(A2, LEN(A2) - FIND(" ", A2)) for the last name. In Microsoft 365, =TEXTSPLIT(A2, " ") does it in one formula.
How do I split a name with a middle name? The middle name is between the two spaces — =MID(A2, FIND(" ", A2) + 1, FIND(" ", A2, FIND(" ", A2) + 1) - FIND(" ", A2) - 1) — and the last name is the last word, =TRIM(RIGHT(SUBSTITUTE(A2, " ", REPT(" ", 50)), 50)).
Why does my last-name formula give me two words? Because it takes everything after the first space — on “David Lee Carter” that is “Lee Carter”. Use the last-word formula for the last name alone.
How do I split “Last, First” format? Split at the comma: =LEFT(A2, FIND(",", A2) - 1) gives the last name and =RIGHT(A2, LEN(A2) - FIND(",", A2) - 1) gives the first name.
What if a name has only one word? FIND returns #VALUE! because there is no space. Wrap the formula in IFERROR — =IFERROR(LEFT(A2, FIND(" ", A2) - 1), A2) — so the single name is returned as it is.
What is the fastest way to split names? Text to Columns (Data tab) for a one-time split, Flash Fill (Ctrl+E) for a pattern, and formulas when the result must update automatically.
That is how to split first and last name in Excel: FIND gives the position of the space, LEFT takes everything before it and RIGHT takes everything after it — =LEFT(A2, FIND(" ", A2) - 1) gives “David” and =RIGHT(A2, LEN(A2) - FIND(" ", A2)) gives “Lee”, from the same cell. On the six names in this guide, that one pair answers most questions, and the two traps are the ones to remember: a three-part name makes the simple last-name formula give two words — “Lee Carter”, not “Carter” — so use the last-word formula for the last name alone, and a “Carter, David” list splits at the comma, not the space. In Microsoft 365, =TEXTSPLIT(A2, " ") does the whole job in one formula, and for a one-time split Text to Columns or Flash Fill is faster — but only the formulas update when the names change. From here, the next functions worth learning are the ones this one sits next to — the extract text after a character guide for the same FIND and TEXTAFTER skills on other text, the combine text guide for joining the pieces back together — and the full learning order for the whole site is on the Excel Formulas hub and the Date & Text topic page.
Learn how to get the month and year from a date in Excel: month name, month number, quarter, first and last day...
Read Guide →Learn how to extract text after a character in Excel: TEXTAFTER and TEXTBEFORE, the last word, and the older FIND method.
Read Guide →Learn the TEXT function in Excel: format codes for currency, dates, percentages, leading zeros, and joining text with numbers.
Read Guide →