Is there a function or set of functions which will return a character
string which appears most often in an array? For example, if I have a list
such as:
apple
orange
orange
kiwi
orange
apple
the formula will return 'orange'.
Tod
=INDEX(A1:A10,MATCH(MAX(COUNTIF(A1:A10,A1:A10)),COUNTIF(A1:A10,A1:A10)))
This formula MUST be array-entered to work, that is, press Ctrl-Shift-Enter
rather than just Enter.
Jim
=INDEX(range,MATCH(MAX(COUNTIF(range,range)),COUNTIF(range,range),0))
Hold down the Ctrl and Shift keys when entering this formula.
David Hager
PeaceMaker <tod...@flex.net> wrote in article
<01bd13eb$58a829e0$1534...@isd-qa-a30.hous-tx.wang.com>...
A B ...... S
vegie other beet
bread other bun
fruit other apple
fruit other peach
fruit other apple
pasta other ravioli
The words in column A will not always be the same and will not always
appear in the same cells, so I can't name a range or reference certain
cells in my formula.
In this example, I want to be able to type the word 'fruit' in a
different cell (on a different worksheet in the workbook) and have a
formula read the word, find in the above example that fruit is
associated with the words apple, peach, and apple in the S column on
the same rows, and then tell me which of the associated words in
column S appears most frequenly. In this case, the answer would be
'apple'.
Thanx for the help so far. Just a few more suggestions and I should
have it.
Tod
apple
orange
David sent me a possible solution and requested that I post it to this
NG.
He wrote:
Here is a solution, albeit with some
limitations:
=INDEX(range2,MATCH(MODE(IF(CODE(IF(range1="c",range2,0))=48,"",CODE(IF(ran
ge1="c",range2)))),CODE(range2),0))
where range2 is Column S and range1 contains "c". The main limitation
is
that the words in Column S all have to begin
with a different letter.
The COUNTIF function cannot be used in this problem (at least in a
single
formula solution) since it only accepts a range
argument as the 1st argument and not an array.
Again, make sure that you repost this in the newsgroup.
Regards,
David Hager
David Hager
PeaceMaker <tod...@flex.net> wrote in article
<34aaae96...@news.supernews.com>...
There are many ways to format the output. One way is to put only Row A & S
in the 'Row' of the pivot table wizard. Do a 'Count of S' in the Data area.
Delete all subtotals for each of the row groups. Also, delete all
Subtotals in the output options.
Now you will find it much easier to work with this data. (again, let Excel
do the hard work.) Hope this helps.
PeaceMaker wrote in message <34aa0473...@news.supernews.com>...
>>Hi All:
>>
>>Is there a function or set of functions which will return a character
>>string which appears most often in an array? For example, if I have a list
>>such as:
>>
>>apple
>>orange
>>orange
>>kiwi
>>orange
>>apple
>>
>>
>>the formula will return 'orange'.
>>
>>Tod
I've seen David Hager's nice formula.
The following is another possible solution. It's a bit tedious, but it
avoids the limitations caused by the MODE function:
=INDEX(Rge2,MAX(ROW(INDIRECT("1:"&ROWS(Rge1)))*(COUNTIF(Rge2,Rge2)
*(Rge1="fruit")=MAX(COUNTIF(Rge2,Rge2)*(Rge1="fruit")))))
... array entered
Cordialement,
Laurent Longre