Split a date into numbers
PremiumIn B2, use SPLIT to split the date text in A2 at the dashes into year, month and day.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Date as text | Year | Month | Day | ||
| 2 | 2024-03-15 | |||||
| 3 | ||||||
| 4 | ||||||
| 5 | ||||||
| 6 | ||||||
| 7 | ||||||
| 8 |
Premium lesson
Unlock SPLIT and JOIN and every other lesson
This is a premium lesson. Premium lets you solve it and every other lesson, take the timed mock tests, and earn certificates you can share on LinkedIn.
Next with premium:REGEX functionsIF
Need help?
Why this works
SPLIT cuts the text at each dash. Parts that look like numbers become numbers, so 03 turns into the number 3 and you can calculate with year, month and day straight away.
Common mistake: Expecting 03 to stay as text. SPLIT turns parts that look like numbers into numbers.
The answer
- B2
=SPLIT(1A2,2"-")
In plain words: Split 1the date text in A2 at 2each dash.