Google-sheets – How to sort number in the form of 00-00

google sheets

I am trying to sort rows by the number of falts & rooms:

1-1 (flat1 room 1)
11-1 (flat 11 room1)
11-8
12-5
13-1
2
5-5

When sorting these rows in an ascending order, it always give wrong order even if I add 0 before every single digit

https://docs.google.com/spreadsheets/d/1D6q7IsdAIIgD-9GuMNSdLhBVDOtKniDW_cy-Td0Sq_I/edit#gid=1162496797

I tried to make a helper column by adding =arrayformula(text(B1:B,"00"))
Also tried to add 0 in front of every number by =arrayformula(0&B5:B). But all didn't work

Best Answer

=ArrayFormula(text(ArrayFormula(IFs(REGEXMATCH(O5:O, "-"), SUBSTITUTE(O5:O,"-",""), O5:O<>"-",O5:O*10)),"00000"))

That solved the issue and sorted the rooms perfectly