Don
Don

Reputation: 45

Google sheets: Parse date from text

Google Sheets - Parsing

From given text, how do you extract the date?

Given text Extracted date (to be generated)
Graduation reunion on Saturday, September 10, 2022 at 123 Front Street September 10, 2022
BBQ Party on Sunday October 1, 2022 at 213 South Street October 1, 2022

Google Sheets link

--

I've tried

=regexextract(A2,"\w{9} \d{2}, \d{4}")*1

As shown in the Google Sheets, this only works for the first one which is September 10, 2022. However, not all months have the same number of characters.

Upvotes: 2

Views: 382

Answers (2)

player0
player0

Reputation: 1

try:

=INDEX(IFNA(REGEXEXTRACT(A2:A, "(\w+ \d+, \d{4})")*1))

enter image description here

Upvotes: 0

Twilight
Twilight

Reputation: 2645

You may use either of the below:

Here, you have to drag down for the formula to populate below

=REGEXEXTRACT(A2,", (.*?) at") 

while the code below, will automatically expand on the column

=ARRAYFORMULA(IF(A2:A="","",REGEXEXTRACT(A2:A,", (.*?) at")))

The formula, will take the characters after the first comma until 'at'.

enter image description here

Upvotes: 3

Related Questions