Forum Discussion
MFelsing
Apr 21, 2023Copper Contributor
Sorting blocks of data
I'm trying to sort lines of code for my CNC Bridge saw. I'd like to be able to select which range of Cut # I can have ran in a reverse order. The lines of code in each Cut have to remain in the ori...
Patrick2788
Apr 21, 2023Silver Contributor
If you have Excel 365, this may work for you:
1. Create an array that identifies each row as Cut 1, Cut 2, etc.
'Ordering
=SCAN(
"",
Source,
LAMBDA(a, v, IF(AND(OR(ISERROR(SEARCH("cut", v)), v = ""), ISNUMBER(SEARCH("cut", a))), a, v))
)2. 'ReSort' Lambda to be called within REDUCE
'ReSort
=LAMBDA(a,v,LET(filtered, FILTER(Source, Ordering = v), VSTACK(a, filtered)))3. An Array constant of Cuts in the desired order:
={"(CUT1)"; "(CUT2)"; "(CUT5)"; "(CUT4)"; "(CUT3)"}
Formula in the sheet:
=REDUCE("Cuts",Cuts,ReSort)