Spreadsheet Practice

How to extract a date from text in Google Sheets

Google Sheets formula

=DATEVALUE(REGEXEXTRACT(A2,"\d{1,2}/\d{1,2}/\d{4}"))

Find the date with REGEXEXTRACT and convert it: =DATEVALUE(REGEXEXTRACT(A2,"\d{1,2}/\d{1,2}/\d{4}")), formatted as a date.

Result on the example
one result per row in B2, filled down to B6
Excel
See below

See it work

The formula is already in B2, filled down to B6. Change any input and the result updates, or edit the formula to experiment.

How it works

The pattern matches one or two digits, a slash, one or two digits, a slash and four digits, wherever the date sits in the note. REGEXEXTRACT returns it as text, and DATEVALUE turns that into a real date, which the date format displays.

=DATEVALUE(REGEXEXTRACT(A2,"\d{1,2}/\d{1,2}/\d{4}"))

Result3/14/2026 (46095)

  1. A2"Invoice 1042 paid on 3/14/2026 by card"

    The value in A2.

  2. REGEXEXTRACT(A2,"\d{1,2}/\d{1,2}/\d{4}")"3/14/2026"

    REGEXEXTRACT: The first match, or the captured group(s). #N/A when nothing matches.

    • textA2"Invoice 1042 paid on 3/14/2026 by card"
    • regular_expression"\d{1,2}/\d{1,2}/\d{4}"
  3. DATEVALUE(REGEXEXTRACT(A2,"\d{1,2}/\d{1,2}/\d{4}"))3/14/2026 (46095)

    DATEVALUE: Converts date text to a date.

    • date_textREGEXEXTRACT(A2,"\d{1,2}/\d{1,2}/\d{4}")"3/14/2026"

In Excel

Excel 365 has REGEXEXTRACT, and the same formula works there. In older versions, cut the date out after a fixed word, for example =DATEVALUE(TRIM(MID(A2,FIND("on ",A2)+3,10))).

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=IFERROR(DATEVALUE(REGEXEXTRACT(A2,"\d{1,2}/\d{1,2}/\d{4}")),"")3/14/2026, 4/2/2026, 12/31/2026…Leaves notes without a date blank instead of showing #N/A.

Common mistakes

  • DATEVALUE reads the text using the spreadsheet's locale. With a UK locale, 4/2/2026 is 4 February. Check File > Settings.
  • The result is a number until the cell is formatted as a date.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Extract a date from text

In B2, find the date (month/day/year) in the note and return it as a real date. Fill down to B6.

Questions

How do I extract ISO dates like 2026-03-14?

Change the pattern: =DATEVALUE(REGEXEXTRACT(A2,"\d{4}-\d{2}-\d{2}")).

How do I get the date as text instead?

Leave out DATEVALUE: =REGEXEXTRACT(A2,"\d{1,2}/\d{1,2}/\d{4}").

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine.