[算表] Excel自訂函數 尋找重複資料
軟體:EXCEL
版本:2010
https://imgur.com/a/xRyLjck
我自訂了一個自訂函數 如下
Function FindDuplicate(範圍)
For Each cell In 範圍
If Application.CountIf(範圍, cell) > 1 Then
FindDuplicate = FindDuplicate & "," & cell.Value
End If
Next
FindDuplicate = Mid(FindDuplicate, 2, Len(FindDuplicate) - 1) '不要第一個,符號
End Function
目的是尋找指定範圍內如果有相同的值則輸出 那個重複的值
所以按圖所述 2出現2次 5出現2次 所以輸出 2,5,2,5
但如果我只想得到 2,5 這樣的結果
應該怎麼修改呢
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.137.45.199
※ 文章網址: https://www.ptt.cc/bbs/Office/M.1543572913.A.58A.html
→
11/30 18:25,
5年前
, 1F
11/30 18:25, 1F
→
11/30 18:25,
5年前
, 2F
11/30 18:25, 2F
→
11/30 18:40,
5年前
, 3F
11/30 18:40, 3F