简体   繁体   中英

How can I return a minimum value in excel work sheet if the cells containing the values I am comparing , the values were created by a function

Am trying to return the minimum value of cells excluding zero but when ever I do it using this function, it returns a zero not the minimum Function: {=MIN(IF(DW2:EE2 = 0,"",DW2:EE2))}

The values in the cells are created by a function which is:

=IF(BJ2="",0,IF(BJ2="D1","1",IF(BJ2="D2","2",IF(BJ2="C3","3",IF(BJ2="C4","4",IF(BJ2="C5","5",IF(BJ2="C6","6",IF(BJ2="P7","7",IF(BJ2="P8","8",IF(BJ2>="F9","9"))))))))))

enter image description here

This answer is wrong, but it might give you an idea.

=IF(MIN(A1:A5)=0,SMALL(A1:A5,2),MIN(A1:A5))

This means the following (I'm always working from a list of values in the cells "A1" till "A5"):

  1. Verify the minimum of the list.
    2.1. If the minimum equals zero, then take the second smallest value.
    2.2. If the minimum does not equal zero, then take that minimum.

However, there is one problem with the implementation of that approach: I expected =Small(range,2) to give the second smallest number of a list, which it does, but it does not, let me show you:

Range : 0, 1, 2, 3, 4, 5 => Small(Range,2) = 1 => OK
Range : 0, 1, 2, 3, 4, 0 => Small(Range,2) = 0 => NOK

Apparently, Small(,2) just orders the range, and takes the second element, regardless of the fact that it might be equal to Small(,1) .

Does anybody know a solution or workaround for this issue?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM