Mode excluding previous numbers

Pestomania

Active Member
Joined
May 30, 2018
Messages
295
Office Version
  1. 365
Platform
  1. Windows
Hello!

In J2 I have Mode of Column B.
In J3 I want to have mode of column B excluding numbers equal to J2.
In J4 I want to have mode of column B excluding J2 and J3 and so forth.

I was able to get J3 to work with =Mode(if(B$2:B$107<>J2, B$2,B$107))

That works perfect. I tried adding and and function to keep it going but can't get it to work.

=Mode(if(and(B$2:B$107<>J2, B$2:B$107<>J3 , B$2,B$107))

I am using [Ctrl]+[Shift]+[Enter]
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Can you clarify exactly what you would want (& why) in J2, J3, J4, J5 & J6 for this sample data?


Excel 2016
B
1
22
33
42
53
62
73
85
96
106
116
124
134
145
15
Mode
 
Upvote 0
So J2 would get the "first mode" which in this case is 2. Then J3 would look for the "second mode" which would be 3. J4 would look at the "third mode" which is 6.

Each time it calculates the mode, I want it to exclude the previous mode.
 
Upvote 0
So J2 would get the "first mode" which in this case is 2. Then J3 would look for the "second mode" which would be 3. J4 would look at the "third mode" which is 6.

Each time it calculates the mode, I want it to exclude the previous mode.
OK, try this. It is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formula can then be copied down.

Note that this will not list single values. Is that an issue for you?

Excel Workbook
BJ
1
222
333
426
535
624
73
85
96
106
116
124
134
145
15
Mode
 
Last edited:
Upvote 0
Note that this will not list single values.
To allow for that, and possible blank cells in the range, try this instead. Still confirmed with Ctrl+Shift+Enter.

Excel Workbook
BJ
1
222
333
426
535
6217
734
85
96
106
116
1217
134
145
15
Mode
 
Upvote 0
To allow for that, and possible blank cells in the range, try this instead. Still confirmed with Ctrl+Shift+Enter.

Excel Workbook
BJ
1
222
333
426
535
6217
734
85
96
106
116
1217
134
145
15
Mode

I tried this program. Unfortunately it didn't include all options. For whatever it stopped calculating after a while. I cannot find the reason why it's not pulling all of them.

In the column there are 50 unique values (multiple occurrences), but it's only pulling 30.
 
Upvote 0
Another option to list single values


B
J
1
Values​
Result​
2
2​
2​
3
3​
3​
4
2​
6​
5
3​
5​
6
2​
17​
7
3​
4​
8
5​
8​
9
6​
11​
10
6​
11
6​
12
17​
13
4​
14
5​
15
16
8​
17
18
11​
19

Array formula in J2 copied down
=IFERROR(MODE(IF(B$2:B$107<>"",IF(ISNA(MATCH(B$2:B$107,J$1:J1,0)),B$2:B$107+{0,0}))),"")
confirmed with Ctrl+Shift+Enter

M.
 
Upvote 0

Forum statistics

Threads
1,216,155
Messages
6,129,185
Members
449,492
Latest member
steveg127

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top