Forum Discussion
TFStenberg
Jun 09, 2026Occasional Reader
Sorting dataentries but keeping separation between subheadings
Hello! I would like to sort datasets with three columns, but keep the sets separate with different subheadings, but sort them all within themselves. I find it difficult to explain further with words...
IlirU
Jun 11, 2026Iron Contributor
Hi TFStenberg​,
If you run Excel 365 then create a Helper Column (in my data I created it in column D - see screenshot) and in cell F2 apply the following formula.
=LET(
data, A2:C34,
group, D2:D34,
sorted, SORTBY(data, group, 1, INDEX(data,, 3), 1),
DROP(VSTACK(TAKE(data, 1), sorted), -1)
)Below is the formula that does not require the creation of a Helper Column.
=LET(
data, A2:C34,
tk, TAKE(data,, -1),
group, SCAN(1, IFERROR(SEQUENCE(ROWS(tk)) / ISTEXT(tk), ""),
LAMBDA(a,b, IF(b = "", a, b))),
sorted, SORTBY(data, group, 1, INDEX(data,, 3), 1),
DROP(VSTACK(TAKE(data, 1), sorted), -1)
)Hope this helps.
IlirU