公式好長 ><
方法一- =INDIRECT(TEXT(SMALL(IF(B3:B12="王五",ROW(3:12)*10+{3,4},IF(C3:C12="王五",ROW(3:12)*10+{2,4},IF(D3:D12="王五",ROW(3:12)*10+{2,3}))),MODE(MATCH(T(INDIRECT(TEXT(SMALL(IF(B3:B12="王五",ROW(3:12)*10+{3,4},IF(C3:C12="王五",ROW(3:12)*10+{2,4},IF(D3:D12="王五",ROW(3:12)*10+{2,3},999))),ROW(INDIRECT("1:"&2*COUNTIF(B3:D12,"王五")))),"!R0C0"),)),T(INDIRECT(TEXT(SMALL(IF(B3:B12="王五",ROW(3:12)*10+{3,4},IF(C3:C12="王五",ROW(3:12)*10+{2,4},IF(D3:D12="王五",ROW(3:12)*10+{2,3},999))),ROW(INDIRECT("1:"&2*COUNTIF(B3:D12,"王五")))),"!R0C0"),)),))),"!R0C0"),)
复制代码 方法二- =INDIRECT(TEXT(SMALL(MMULT((B3:D12="王五")*ROW(3:12),{1;1;1})*10+{2,3,4},2*COUNTIF(B3:D12,"王五")+MODE(MATCH(SUBSTITUTE(T(INDIRECT(TEXT(SMALL(MMULT((B3:D12="王五")*ROW(3:12),{1;1;1})*10+{2,3,4},ROW(INDIRECT(2*COUNTIF(B3:D12,"王五")+1&":30"))),"!R0C0"),)),"王五",ROW(INDIRECT(2*COUNTIF(B3:D12,"王五")+1&":30"))),SUBSTITUTE(T(INDIRECT(TEXT(SMALL(MMULT((B3:D12="王五")*ROW(3:12),{1;1;1})*10+{2,3,4},ROW(INDIRECT(2*COUNTIF(B3:D12,"王五")+1&":30"))),"!R0C0"),)),"王五",ROW(INDIRECT(2*COUNTIF(B3:D12,"王五")+1&":30"))),))),"!R0C0"),)
复制代码 方法一思路說明
思路一
IF(B3:B12="王五",ROW(3:12)*10+{3,4},IF(C3:C12="王五",ROW(3:12)*10+{2,4},IF(D3:D12="王五",ROW(3:12)*10+{2,3})))
{33,34;FALSE,FALSE;53,54;FALSE,FALSE;72,73;83,84;92,93;FALSE,FALSE;FALSE,FALSE;122,123}
即傳回與五五同天值班的行列號
思路二
T(INDIRECT(TEXT(SMALL(IF(B3:B12="王五",ROW(3:12)*10+{3,4},IF(C3:C12="王五",ROW(3:12)*10+{2,4},IF(D3:D12="王五",ROW(3:12)*10+{2,3},999))),ROW(INDIRECT("1:"&2*COUNTIF(B3:D12,"王五")))),"!R0C0"),))
{"张三丰";"张三";"李四光";"张一";"李四光";"张三";"张三丰";"张一";"张一";"李四";"张一";"张三丰"}
即傳回與王五同天值班的人員
思路三
MODE(MATCH(T(INDIRECT(TEXT(SMALL(IF(B3:B12="王五",ROW(3:12)*10+{3,4},IF(C3:C12="王五",ROW(3:12)*10+{2,4},IF(D3:D12="王五",ROW(3:12)*10+{2,3},999))),ROW(INDIRECT("1:"&2*COUNTIF(B3:D12,"王五")))),"!R0C0"),)),T(INDIRECT(TEXT(SMALL(IF(B3:B12="王五",ROW(3:12)*10+{3,4},IF(C3:C12="王五",ROW(3:12)*10+{2,4},IF(D3:D12="王五",ROW(3:12)*10+{2,3},999))),ROW(INDIRECT("1:"&2*COUNTIF(B3:D12,"王五")))),"!R0C0"),)),))
= MODE(MATCH(思路二,思路二,))
利用MATCH與MODE來找出在思路二出現重複次數最高的位址
思路四
SMALL(IF(B3:B12="王五",ROW(3:12)*10+{3,4},IF(C3:C12="王五",ROW(3:12)*10+{2,4},IF(D3:D12="王五",ROW(3:12)*10+{2,3}))),MODE(MATCH(T(INDIRECT(TEXT(SMALL(IF(B3:B12="王五",ROW(3:12)*10+{3,4},IF(C3:C12="王五",ROW(3:12)*10+{2,4},IF(D3:D12="王五",ROW(3:12)*10+{2,3},999))),ROW(INDIRECT("1:"&2*COUNTIF(B3:D12,"王五")))),"!R0C0"),)),T(INDIRECT(TEXT(SMALL(IF(B3:B12="王五",ROW(3:12)*10+{3,4},IF(C3:C12="王五",ROW(3:12)*10+{2,4},IF(D3:D12="王五",ROW(3:12)*10+{2,3},999))),ROW(INDIRECT("1:"&2*COUNTIF(B3:D12,"王五")))),"!R0C0"),)),)))
= SMALL(思路一,思路三)
[ 本帖最后由 piny 于 2011-6-13 12:43 编辑 ] |