Google-sheets – How to sort a column with date that is impeded within Texts

google sheetsgoogle-sheets-arrayformulagoogle-sheets-dates

I have a list of files' names that I would like to sort based on the date that's impeded within the file name text (Column A folder). When sorting them, the number 10 comes after 1 instead of 1,2,3,4,5….etc. So, I came up with a new column (G) that has the number of day only being extracted from the file name (Column A) by this formula:

=ArrayFormula(iferror(Right(REGEXEXTRACT(A2:A,"/.."),2)))

But still I can't sort the rows as expected… 10 comes after 1, 20 after 2 and 30 after 3.. Any idea how to solve this issue?enter image description here

Best Answer

What you actually want is to sort your data based on column A.
To do this you do not need a helper column (like column E).

This is the simpler formula you need to use

=SORT(A2:D,ArrayFormula(IFERROR(TEXT(VALUE(REGEXEXTRACT(A2:A,"/(\d+)")),"00"))),1)

enter image description here