excel 如何利用寫入函數得到對應的名稱去計算得到E2、E5、E8、E11的數據?加總名稱欄中包含的字樣對應的次數,並加以加總
比如包含有A字樣的次數加總E2儲存格中的總和為51,這樣的函數該怎麼寫呢?
name 次數 包含有A字樣的次數加總
A-1 6 51
C 1
A-7 1 包含有C字樣的次數加總
B 4 38
CD 5
F88 6 包含有B字樣的次數加總
A-1 1 27
C-2 2
A-7 3 包含有F字樣的次數加總
A-1 4 22
C 2
A-7 6
B38 7
CD-4 1
F3 9
A-1 3
C-2 11
A-7 3
A-1 13
C 14
A-7 8
B7 16
CD-8 2
F4 7
A-1 3
一般版本做法:
E2:
=SUMPRODUCT((LEFT(A2:A100)="A") * (C2:C100))
E5:
=SUMPRODUCT((LEFT(A2:A100)="C") * (C2:C100))
E8:
=SUMPRODUCT((LEFT(A2:A100)="B") * (C2:C100))
E11:
=SUMPRODUCT((LEFT(A2:A100)="F") * (C2:C100))
2019及365版本做法:
E2:
=SUM(FILTER(C2:C100,LEFT(A2:A100)="A"))
E5:
=SUM(FILTER(C2:C100,LEFT(A2:A100)="C"))
E8:
=SUM(FILTER(C2:C100,LEFT(A2:A100)="B"))
E11:
=SUM(FILTER(C2:C100,LEFT(A2:A100)="F"))