Home > OS >  Exclude certain values from SORT function
Exclude certain values from SORT function

Time:01-08

   |      A       |  
---|--------------|--
1  |    inactive  |    
2  |    Warning   | 
3  |    Error     | 
4  |    Warning   | 
5  |    O.K.      |
6  |    Error     |
7  |    O.K.      |
8  |    O.K.      |
9  |    inactive  |
10 |              |
11 |              |
---|--------------|---
12 |    Warning   |
13 |              |

In the Range A1:A11 I want to

  1. check if there is a value <> O.K.
  2. If yes, the values with Warning should be prioritized over the values with Error and displayed accordingly in cell A12.
  3. The value inactive - and any other value except Error and Warning - should be completely ignored.

With reference to this question I was able to make the first 2 bullet points work:

=@SORT(FILTER(A1:A11,A1:A11<>"O.K."),,-1)

However, with this formula the result in Cell A12 is inactive but it should be warning.
How do I have to modify it to completely ignore inactive and any other value except Warning and Error?

CodePudding user response:

A Microsoft365 dynamic formulas variant:

=@SORT(FILTER(A1:A11,(A1:A11="Warning") (A1:A11="Error"),"O.K."),1,-1)
  •  Tags:  
  • Related