Array formula to return an ARRAY without duplicates, without VBA

后端 未结 3 1874
野性不改
野性不改 2021-02-06 20:04

I would like to know whether it\'s possible to return an array from a single cell formula, which is filtered to remove duplicates, and which is built purely on Excel formulas.

3条回答
  •  臣服心动
    2021-02-06 20:16

    I have used a defined name for the Range (A1:A5) and called it myList. You can do the same, or substitute in the Address $A$1:$A$5 if you wish:

    {=INDEX(myList, N(IF({1}, MODE.MULT(IF(MATCH(myList, myList, 0) = ROW(myList), ROW(myList)*{1,1})))), 1)}

    EDIT: Above wasn't robust to handle if the column list is further down the sheet, and a shorter minrow routine courtesy of OP:

    {=INDEX(myList, N(IF({1}, MODE.MULT(IF(MATCH(myList, myList, 0)=ROW(myList)-MIN(ROW(myList))+1, (ROW(myList)-MIN(ROW(myList))+1)*{1,1})))), 1)}

    This should be ok for you. Needless to say, these are array formulas..

提交回复
热议问题