Modifying SUMIFS formula to a MODE formula??

Jimmy05T

New Member
Joined
Apr 25, 2017
Messages
3
Hello - I am looking to modify a SUMIFS formula I have in my worksheet to calculate the MODE of the range rather than sum the range. I have the set up as below and have a SUMIFS formula that sums all the values between two dates in a selected column. However, I would like to be able to identify the most common value in a range of dates in a chosen column. I would like to be able to have a column, start and end date inputs as per the SUMIFS formula. Is this possible? Please let me know if you require any further clarification?


A B C D E
1
2 Names
3 Data $B$7:$E$17
4 Dates $B$7:$B$17
5 Customers $B$7:$E$7
6
7 # A B
8 01/04/2017 3 1 2
9 02/04/2017 3 2 1
10 03/04/2017 7 4 3
11 04/04/2017 6 2 4
12 05/04/2017 6 2 4
13 06/04/2017 3 1 2
14 07/04/2017 3 2 1
15 08/04/2017 4 1 3
16 09/04/2017 4 2 2
17 10/04/2017 4 3 1
18
19 # 22 =SUMIFS(INDEX(Data,0,MATCH($B$19,Customers,0)),Dates,">="&$C$20,Dates,"<="&$C$21)
20 Start 03/04/2017
21 End 06/04/2017
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Try this


Excel 2010
ABCD
84/1/2017312
94/2/2017321
104/3/2017743
114/4/2017624
124/5/2017624
134/6/2017312
144/7/2017321
154/8/2017413
164/9/2017422
174/10/2017431
18
19Column1
20Start4/3/2017
21End4/6/2017
22Mode6
Sheet1
Cell Formulas
RangeFormula
B22{=MODE(IF((B20<=A8:A17)*(B21>=A8:A17),INDEX(B8:D17,,B19)))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Thank you - this worked great. Would you know an easy way to amend the formula to exclude 0 values in the MODE calculation?


Try this

Excel 2010
ABCD
84/1/2017312
94/2/2017321
104/3/2017743
114/4/2017624
124/5/2017624
134/6/2017312
144/7/2017321
154/8/2017413
164/9/2017422
174/10/2017431
18
19Column1
20Start4/3/2017
21End4/6/2017
22Mode6

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Array Formulas
CellFormula
B22{=MODE(IF((B20<=A8:A17)*(B21>=A8:A17),INDEX(B8:D17,,B19)))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0
Thank you - this worked great. Would you know an easy way to amend the formula to exclude 0 values in the MODE calculation?

Try including *(B8:D17<>0) into the formula. The formula would then become:

=MODE(IF((B20<=A8:A17)*(B21>=A8:A17)*(B8:D17<>0),INDEX(B8:D17,,B19))) Ctrl Shift Enter
 
Upvote 0
Thank you - however, what if the whole row isn't 0, just a data point in say column 2? But other columns do have values. Is there a way it can just exclude the 0 values when calculating the MODE for that column? (but still keeping the column selection dynamic as part of the formula)

Thank you for your help and apologies for not being clear.


Try including *(B8:D17<>0) into the formula. The formula would then become:

=MODE(IF((B20<=A8:A17)*(B21>=A8:A17)*(B8:D17<>0),INDEX(B8:D17,,B19))) Ctrl Shift Enter
 
Upvote 0
If I am understanding you correctly it should work. Did you try it? In the example below, the mode (in the first column between the date range) would normally be 0 but the formula ignores that and returns 7.


Excel 2010
ABCD
84/1/2017312
94/2/2017321
104/3/2017743
114/4/2017724
124/5/2017024
134/6/2017012
144/7/2017021
154/8/2017413
164/9/2017422
174/10/2017431
18
19Column1
20Start4/3/2017
21End4/7/2017
22Mode7
Sheet1
Cell Formulas
RangeFormula
B22{=MODE(IF((B20<=A8:A17)*(B21>=A8:A17)*(B8:D17<>0),INDEX(B8:D17,,B19)))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,214,581
Messages
6,120,372
Members
448,957
Latest member
BatCoder

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