Excel如何显示从一个范围最重复的名称?

我的Column A

 Apple Orange Apple Aple Mango Column B Apple Mango Apple Mango Mango Column C Apple Apple Apple Apple Apple 

在单个列上显示最重复的名称(如列A)我使用这种代码 –

 =INDEX(A1:A5,MODE(IF(A1:A5<>0,MATCH(A1:A5,A1:A5,0)))) 

代码返回col.A最重复的名称: Apple

但是,该代码只适用于单列。 与三列工作时,它不工作。 我该怎么办? 我试图改变A1: C5但它不工作。

这个“数组公式”将得到最重复的文本

=INDIRECT("R"&TEXT(MIN(IF(COUNTIF(A1:C5,A1:C5)=MAX(COUNTIF(A1:C5,A1:C5)),ROW(A1:C5)*1000+COLUMN(A1:C5))),"0\C000"),0)

CTRL + SHIFT + ENTER确认

这将工作范围高达999列 – 如果有关系,它只会给第一个,首先在每一行工作

这是和想法。

您可以find每列最重复的单词,并将结果放入结果列中。 因此, column A的最重复单词结果将在column D row 1column B的最重复单词结果将在column D row 2 ,并且column C的最重复单词结果将在column D row 3 。 然后在column Dfind最重复的单词,从而为您提供所有列中重复最多的单词。

或者你可以使用PowerShell脚本 。

尝试这个:

 Sub MostDupesInRange() Dim ws As Worksheet Dim rng As Range Dim cell As Range Dim dupes As Long Dim maxDupes As Long Dim dupeWord As String Dim dupeTie As Boolean Set ws = ThisWorkbook.Sheets("Sheet1") Set rng = ws.Range("A1:D8") For Each cell In rng dupes = Application.WorksheetFunction.CountIf(rng, cell) If dupes > maxDupes Then maxDupes = dupes dupeWord = cell.Value dupeTie = False End If If dupes = maxDupes And InStr(1, dupeWord, cell.Value) = False Then dupeWord = dupeWord & ", " & cell.Value dupeTie = True End If Next cell If dupeTie = False Then MsgBox dupeWord & "" _ & "appears in the range " & maxDupes & " times." If dupeTie = True Then MsgBox "The values (" & _ dupeWord & ") appear in the range " & maxDupes & " times." End Sub 

注意:这也将检测是否有重复值最高的值的平局。 我最初的回答并没有包括这个,但是让我感到不满的是,