Using the Excel SMALL function with filtering criteria AND ignoring zeros

后端 未结 4 418
清歌不尽
清歌不尽 2021-01-25 04:57

I have a list of prices for products that are variations (different size, color) of multiple parent product. Some products (for reasons not important to this question) have a p

4条回答
  •  梦毁少年i
    2021-01-25 05:13

    If the input data is sorted based on the parent reference level you can simply

    • use offset to find the required parent reference cells containing the price
    • Find the k-th smallest value using the SMALL formula (i.e. the smallest value)
    • Put a if condition to give you the 2nd smallest value if the smallest is 0

    Place this in the 1st row

    =IF(SMALL(OFFSET($I$1,MATCH(C1,$C:$C,0)-1,0,COUNTIF($C:$C,C1)),1)=0,SMALL(OFFSET($I$1,MATCH(C1,$C:$C,0)-1,0,COUNTIF($C:$C,C1)),2),SMALL(OFFSET($I$1,MATCH(C1,$C:$C,0)-1,0,COUNTIF($C:$C,C1)),1))
    

提交回复
热议问题