0

I have a regexextract formula which takes the year from Column A (column) - however this only works if the year is yyyy-yy format - however some of the years are only yyyy and it returns an error

Is it possible for the formula to regextract yyyy too?

Essentially only want numbers from products corresponding to their years - not numbers later in the string

https://docs.google.com/spreadsheets/d/1wlI47SEdiAjuY1xgSwIMnUqecbcwfADBuKWp2GtmZ_o/edit?usp=sharing

2
  • magelincs, give us the access authorization
    – Daniele
    May 24, 2022 at 16:09
  • Apologies - have changed permissions now
    – magelincs
    May 24, 2022 at 16:45

1 Answer 1

1

simply add a question mark, like this:

=REGEXEXTRACT(A2,"\d+-?\d+")

you could make an array for that formula with:

=index(if(A2:A<>"",REGEXEXTRACT(A2:A,"\d+-?\d+"),))

if instead you prefer to get exclusively the year

=index(if(A2:A<>"",REGEXEXTRACT(A2:A,"\d+"),))
1
  • Ah fantastic - thanks a lot!
    – magelincs
    May 24, 2022 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.