Forum Discussion

michaelhou's avatar
michaelhou
Copper Contributor
May 26, 2022
Solved

Conditional custom sorting in excel

Hey guys,

 

I have a simple excel table that I would like to sort based on a few columns. However instead of multi level custom sorting on different columns, I would like the program to execute a different sorting algorithm for cells that contain certain text in a column.

Examples below

Say I'd like to sort by market first, and then by team, and then by product. But then when the market is for example "China" I would like those cells to be sorted by just product (ignoring team). Is there a way to achieve this?

 

Many thanks,

  • michaelhou 

    I'd add a helper column with formula

    =IF(marketcell="China", productcell, teamcell)

    and use that as second sort key instead of Team.

Resources