Forum Discussion

camema's avatar
camema
Copper Contributor
Jul 30, 2023

Sorting different column

How can I sort a table based on different columns. In the example, not using the column D formula, but a custom list. Grazie

 e2IdSpec_Tech_Severity > L1Ground_Severity > L1 
OR-0000000000162707 A1
OR-0000000000157638A 1
OR-0000000000158608 B2
OR-0000000000157599 B2
OR-0000000000174000 B2
OR-0000000000164019B 2
OR-0000000000164784 B2
OR-0000000000153344C 3
OR-0000000000155686C 3
OR-0000000000155142 C3
OR-0000000000157965 C3
OR-0000000000161288 C3
OR-0000000000164005 C3
OR-0000000000164828 C3
OR-0000000000173899 C3
OR-0000000000158613 D4
OR-0000000000164078D 4

 

  • camema 

    If you want an interactive process without a helper column you have problems.  An ideal solution might be to sort the data using Power Query before it is ever loaded to the spreadsheet.  Another possibility is to leave the data table untouched and use a formula to generate a sorted copy.

    = LET(
        specTech, CHOOSECOLS(table,2),
        ground,   CHOOSECOLS(table,3),
        combined, specTech & ground,
        sorted,   SORTBY(table, combined),
        IF(sorted<>"", sorted, "")
      )

  • camema 

    If I understand your question correctly, you want to sort on the combination of columns B and C.

    I'm afraid that is not possible - you'll have to sort on a single column with a formula based on the contents of columns B and C.

Resources