Previous in Forum: Strat up menu   Next in Forum: dmp & dat file
Close
Close
Close
19 comments
Rate Comments: Nested
Guru
Engineering Fields - Manufacturing Engineering - New Member Hobbies - Target Shooting - New Member United States - Member - New Member Hobbies - Hunting - New Member

Join Date: Dec 2006
Location: Charlotte, NC USA
Posts: 791
Good Answers: 17

Microsoft Excel

11/10/2009 10:30 AM

Hi All,

I have an array of numbers in an excel spreadsheet. I would like to find the most repeated number, then the second most repeated number and then the third most repeated number... and so on and so forth

Suggestions??

thanks

Laby

__________________
Be careful of what you wish for .....
Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Anonymous Poster
#1

Re: Excel Question...

11/10/2009 10:39 AM

=countif function?

Register to Reply
Guru

Join Date: Aug 2009
Location: Glen Mills, PA.
Posts: 2385
Good Answers: 114
#2

Re: Excel Question...

11/10/2009 11:01 AM

Repeated complete number or digit?

__________________
In a time of universal deceit, telling the truth is a revolutionary act. George Orwell
Register to Reply
Guru
Engineering Fields - Manufacturing Engineering - New Member Hobbies - Target Shooting - New Member United States - Member - New Member Hobbies - Hunting - New Member

Join Date: Dec 2006
Location: Charlotte, NC USA
Posts: 791
Good Answers: 17
#13
In reply to #2

Re: Excel Question...

11/11/2009 2:00 PM

Complete number

__________________
Be careful of what you wish for .....
Register to Reply
Power-User
Hobbies - Hunting - Deer and Birds Hobbies - HAM Radio - Achieved Ham Radio license in 2008 Hobbies - Fishing - Fisherman United States - US - Statue of Liberty - Know freedom, no tyranny.  Know tyranny, no freedom. Hobbies - DIY Welding - Beginner

Join Date: Sep 2009
Location: Pacific Northwest USA
Posts: 223
Good Answers: 19
#3

Re: Excel Question...

11/10/2009 11:25 AM

The countif function will give you how many times a number is in the array, however you have to type that predetermined number into the function formula for the countif to look for it. The function you seek is MODE. If your array is in B1:B20, then the function formula is =MODE(B1:B20) and the result will be the one number that appears most often. Then, set up another MODE function inside a formula that says NOT (the previous MODE result) and so on. It's been a long time since I did this and I am going from old memory, I didn't go into Excel and try this - so be kind if I missed a step!

__________________
Go green, use a solar powered light saber...
Register to Reply
Guru
Engineering Fields - Manufacturing Engineering - New Member Hobbies - Target Shooting - New Member United States - Member - New Member Hobbies - Hunting - New Member

Join Date: Dec 2006
Location: Charlotte, NC USA
Posts: 791
Good Answers: 17
#4
In reply to #3

Re: Excel Question...

11/10/2009 12:02 PM

that sounds like what I need Master Skywalker, but I'm fuzzy on the second part, how do you tell it "Not the previous MODE result." ???

__________________
Be careful of what you wish for .....
Register to Reply
Power-User
Hobbies - Hunting - Deer and Birds Hobbies - HAM Radio - Achieved Ham Radio license in 2008 Hobbies - Fishing - Fisherman United States - US - Statue of Liberty - Know freedom, no tyranny.  Know tyranny, no freedom. Hobbies - DIY Welding - Beginner

Join Date: Sep 2009
Location: Pacific Northwest USA
Posts: 223
Good Answers: 19
#5

Re: Excel Question...

11/10/2009 12:55 PM

a) Run the MODE function on array in first column, the answer is in second column, the same all the way down all rows, number 2 appears most often, b) run a simple IF array minus MODE result equals zero then return X, =IF(F5<>0,D5,"X") if it results in some other number then display number, c) run MODE on resultant column which now is void of first results. Might be easier way but this works!!!

Answer 1CalcAnswer 2
220X
3213
4224
5235
220X
220X
220X
3213
3213
5235
23
__________________
Go green, use a solar powered light saber...
Register to Reply Score 1 for Good Answer
Guru
Engineering Fields - Manufacturing Engineering - New Member Hobbies - Target Shooting - New Member United States - Member - New Member Hobbies - Hunting - New Member

Join Date: Dec 2006
Location: Charlotte, NC USA
Posts: 791
Good Answers: 17
#14
In reply to #5

Re: Excel Question...

11/11/2009 2:03 PM

that worked for me. I then went in and colored all the numbers white so they are not seen and put the MODE functions at the top in a header format.

Now it works well, looks cool and no one knows I'm using so much of the spreadsheet.

Thanks

__________________
Be careful of what you wish for .....
Register to Reply
Power-User
Hobbies - Hunting - Deer and Birds Hobbies - HAM Radio - Achieved Ham Radio license in 2008 Hobbies - Fishing - Fisherman United States - US - Statue of Liberty - Know freedom, no tyranny.  Know tyranny, no freedom. Hobbies - DIY Welding - Beginner

Join Date: Sep 2009
Location: Pacific Northwest USA
Posts: 223
Good Answers: 19
#18
In reply to #14

Re: Excel Question...

11/12/2009 3:52 PM

I like the color font idea - good addition. Glad to have helped!!!

Matt

__________________
Go green, use a solar powered light saber...
Register to Reply
Guru
Engineering Fields - Electrical Engineering - Analog and Digital Circuit Design Engineering Fields - Electromechanical Engineering - Transformers, Motors & Drives, EM Launchers Engineering Fields - Engineering Physics - Applied Electrical, Optical, and Mechanical

Join Date: Jan 2008
Location: NY
Posts: 1207
Good Answers: 119
#6

Re: Microsoft Excel

11/11/2009 12:52 AM

There is an array function called {Frequency} in the Open Office clone of Excel. It counts the frequency of data elements that fit into defined bins and outputs the result into an array. This may (or may not) work for you.

Register to Reply Score 1 for Good Answer
Guru
Panama - Member - New Member Hobbies - CNC - New Member Engineering Fields - Marine Engineering - New Member Engineering Fields - Retired Engineers / Mentors - New Member

Join Date: Dec 2006
Location: Panama
Posts: 4273
Good Answers: 213
#11
In reply to #6

Re: Microsoft Excel

11/11/2009 9:36 AM

The Frequency function also exists in Excel, and was designed to do exactly what the OP is looking to accomplish. Well-documented in Excel Help...

Register to Reply
Associate

Join Date: Sep 2008
Posts: 54
Good Answers: 1
#7

Re: Microsoft Excel

11/11/2009 1:17 AM

if your file is not confidential, upload it here i'll write a small vba code for you

Register to Reply
Anonymous Poster
#8

Re: Microsoft Excel

11/11/2009 2:59 AM

a million years ago, I could have written the formula. but =mode(a1:a60000) would return the most frequently appearing number. Then use the property of parentheses to generate the not operators. =mode(a1:a60000)!(=mode(a1:a60000)) then =mode(a1:a60000)!(=mode(a1:a60000)!(=mode(a1:a60000))) or just get the mode, do a search and replace that replaces the mode with a random string beginning with a predictable string like NOTFIRSTMODEoeiuweoweiueworiuoiueteoriutqpewiurf (the lowercase part will require you to write a fun little random string generator), then get the mode again and a search and replace with NOTSECONDMODEoeiuweoweiueworiuoiueteoriutqpewiurf then do the mode a third time. Two search and replaces replacing cells containing NOTFIRSTMODE and NOTSECONDMODE with the first and second mode. Slower? More complicated? You bet! Why get two things done in a day when you can get one thing done very slowly in a couple of days? By working unproductively, you ensure that your friends won't get laid off because fo your efficiency.

Register to Reply
Associate

Join Date: Jun 2008
Location: Gujarat
Posts: 43
Good Answers: 1
#9

Re: Microsoft Excel

11/11/2009 4:22 AM

Hi ,

I could tell you the most repeated number in an array and its frequency by the following formula . Press CTRL+SHIFT+ENTER to get the value in the cell .Try to dig out the second repeated number by modify this formula.

For ex computing values from b4 to b13.

INDEX(B4:B13,MATCH(MAX(FREQUENCY(B4:B13,B4:B13)),COUNTIF(B4:B13,B4:B13),0)) & "and "&MAX(FREQUENCY(B4:B13,B4:B13))

Regards

Earnest.

Register to Reply
Guru

Join Date: Oct 2009
Posts: 1460
Good Answers: 30
#10

Re: Microsoft Excel

11/11/2009 9:28 AM

This is a quick and dirty method. Insert a column next to your array column for the countif function. If the array is in C10:C20, then the formula for D10 is =COUNTIF($C$10:$C$20,C10). Copy this to C11:C20. Then sort C10:D20 on column D. Peter Harris

Register to Reply
Guru
Engineering Fields - Manufacturing Engineering - New Member Hobbies - Target Shooting - New Member United States - Member - New Member Hobbies - Hunting - New Member

Join Date: Dec 2006
Location: Charlotte, NC USA
Posts: 791
Good Answers: 17
#12
In reply to #10

Re: Microsoft Excel

11/11/2009 2:00 PM

This did NOT do what I wanted it to do. This counted the number of times a number showed up in the array. My problem is I don't know which number shows up the most. (I have 59 different cutters being used on various jobs and I don't know what is used when.)

Thanks for the effort.. I know you took time out of your day and played with it to get it to work...

Laby

__________________
Be careful of what you wish for .....
Register to Reply
Guru

Join Date: Oct 2009
Posts: 1460
Good Answers: 30
#17
In reply to #12

Re: Microsoft Excel

11/11/2009 5:39 PM

Sorry, but it works for me. The number which shows up 4 times happens more often than the number which shows up 3 times, and the sorting process puts into order the ones that happen most. If two or more numbers have the same frequency you can tidy it with a secondary sort on the number. Regards, Peter

Register to Reply
Guru
Popular Science - Weaponology - New Member Fans of Old Computers - PDP 11 - New Member Technical Fields - Architecture - New Member Hobbies - HAM Radio - New Member

Join Date: Oct 2009
Location: Maine, USA
Posts: 2168
Good Answers: 71
#15

Re: Microsoft Excel

11/11/2009 4:00 PM

If the number of items in the array is small enough to count by hand, just sort the column and all the like numbers will be together...then count them.

Probably too simple an answer but it's what came to mind!

__________________
Tom - "Hoping my ship will come in before the dock rots!"
Register to Reply
Power-User

Join Date: Apr 2007
Posts: 319
Good Answers: 4
#19
In reply to #15

Re: Microsoft Excel

11/14/2009 9:59 AM

You are a consultant, aren't you? I just guessed from your answer.

Just joking...no offense meant.

i understand you are trying to infuse some fun into this boring tech. discussion!

__________________
sisira
Register to Reply Off Topic (Score 5)
Guru

Join Date: Feb 2008
Posts: 638
Good Answers: 45
#16

Re: Microsoft Excel

11/11/2009 4:00 PM

PIVOT TABLE

data
1Count of data2
4data2Total
556
763
832
942
572
482
592
611
521
3121
2Grand Total22
3
5
6
7
8
9
12
6
5
__________________
This moment is as it should be.
Register to Reply
Register to Reply 19 comments

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Copy to Clipboard

Users who posted comments:

Anonymous Poster (2); cwarner7_11 (1); earnestpaul (1); Labyguy (4); Matt Skywalker (3); mjb1962853 (1); passingtongreen (1); phph001 (2); Sisira (1); szwasta (1); Tom_Consulting (1); wasaadeh (1)

Previous in Forum: Strat up menu   Next in Forum: dmp & dat file

Advertisement