mardi 2 novembre 2021

How to format cell value from number to date / or plain text in Sheets so if formula with defined values works

I had this IF formula that grouped my years in certain groups, but now that I've changed how I extract year from data (so it covers other types of "data" formats or other format outliers in data set) its not working anymore. I've tried formatting it to date, and it works but not for just years (haven't even got to the other outliers). Can't make it work if I first regexextract year based on digit format and then try to format it from Sheets options. In the end I want to be able to group the years I extract into year groups. This sample should make more sense.

Regex I'm using:

=IFERROR(REGEXEXTRACT(D2,"\d\d\d\d"),IF(REGEXMATCH(D2,"century")=TRUE,REGEXEXTRACT(D2,"\d\d"),"Check"))

Not working with my year group formula:

=IF(E2<2000,"pre-2000",IF(AND(E2>=2000,E2<=2010),"2000-2010",IF(AND(E2>=2011,E2<=2016),"2011-2016",IF(AND(E2>=2017,E2<=2021),"2017-2021",IF(AND(E2<>"No year found",E2>2021),"post-2021","Check")))))

Thanks

Aucun commentaire:

Enregistrer un commentaire