How to find the maximum value in a column based on month and year?

LRATOZ

Board Regular
Joined
Aug 17, 2014
Messages
59
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I have been collecting weather data for six years and I would like to make a dashboard that shows me the following:

The highest recorded temperature per month for each year.
(Similar as the record values in the climate table at Climate of Melbourne - Wikipedia)

My spreadsheet has got a column showing every dat over the last six years and has also a temperature reading for each date.

So, I want to find the highest temperature per month and per year with the date when it happened.
To find the maximum value per column is easy but I would like to see the maximum value for each month and on what date and in which year it happened.

Obviously, I record much more the just the temperature but once I know how to do this then it will be easy to apply the same formula to different data types.
So, if somebody has a solution this I would be grateful to hear about it.
Thank you very much in advance!
Luke
 
OK, I spent more time on this and now I am on the right track
I created a simple file that has two colums:
Column A lists all dates between 01-01-2018 and 31-05-2019 (XL2BB has a limit of 3000 cells)
Column B contains a random value between 1 and 100

In C1 I got the formula: =MAX(INDEX((MONTH(date)=3)*(YEAR(date)=2018)*Value,0))

The value returned is: 77
The formula as is shows me the maximum value for the 3rd month of 2018, so, I'm on the right track.
I just need to make a slight adjustment that will show me:
The maximum value for March over all the years.
The maximum value for March 2019 is: 99
So, I would like to see the maximum value for a particular month over multiple years and with the date when it occurred.
In this case it should show me: 99 but it happened on two occasions: 27-3-2019 and 31-03-2019.
In this case I want to keep the earliest date.

Please ignore the differences in the RANDOM-functions as this is not important. I just wanted to have the cells populated with random numbers between 1 and 100 to prove a point.

I'm I asking too much from Excel? Can this be done?

2021-06-02 Weather test sheet.xlsx
ABC
11/01/20183277
22/01/201881
33/01/20186
44/01/201863
55/01/201837
66/01/201883
77/01/201860
88/01/201884
99/01/201816
1010/01/201863
1111/01/201856
1212/01/201833
1313/01/201897
1414/01/2018100
1515/01/201895
1616/01/201859
1717/01/201825
1818/01/201874
1919/01/201822
2020/01/201870
2121/01/201814
2222/01/201880
2323/01/201888
2424/01/201853
2525/01/201838
2626/01/201834
2727/01/201844
2828/01/201853
2929/01/201885
3030/01/201856
3131/01/20182
321/02/201815
332/02/201832
343/02/201843
354/02/201829
365/02/201895
376/02/201840
387/02/20187
398/02/201879
409/02/201858
4110/02/201854
4211/02/20182
4312/02/201878
4413/02/201827
4514/02/201834
4615/02/201827
4716/02/201873
4817/02/20189
4918/02/201846
5019/02/201829
5120/02/201887
5221/02/201815
5322/02/201888
5423/02/201872
5524/02/201884
5625/02/201847
5726/02/201883
5827/02/201868
5928/02/201819
601/03/201870
612/03/201859
623/03/201853
634/03/201827
645/03/201866
656/03/201870
667/03/20182
678/03/201874
689/03/201864
6910/03/201869
7011/03/201816
7112/03/201853
7213/03/201842
7314/03/201832
7415/03/201820
7516/03/201858
7617/03/20185
7718/03/201870
7819/03/201877
7920/03/201865
8021/03/201835
8122/03/201854
8223/03/201817
8324/03/201860
8425/03/20186
8526/03/201870
8627/03/201834
8728/03/20187
8829/03/201813
8930/03/201816
9031/03/20187
911/04/201822
922/04/201892
933/04/201893
944/04/201818
955/04/201822
966/04/201886
977/04/201870
988/04/201828
999/04/201880
10010/04/201843
10111/04/201818
10212/04/201879
10313/04/201863
10414/04/201844
10515/04/201888
10616/04/201843
10717/04/201825
10818/04/201855
10919/04/201867
11020/04/201896
11121/04/201850
11222/04/201838
11323/04/201882
11424/04/201812
11525/04/201825
11626/04/201812
11727/04/201818
11828/04/201829
11929/04/201816
12030/04/201899
1211/05/201831
1222/05/20187
1233/05/201869
1244/05/20186
1255/05/201827
1266/05/201863
1277/05/201847
1288/05/201889
1299/05/201819
13010/05/201876
13111/05/201826
13212/05/201857
13313/05/201849
13414/05/201856
13515/05/201883
13616/05/20188
13717/05/201831
13818/05/201899
13919/05/201853
14020/05/201890
14121/05/201813
14222/05/201824
14323/05/201870
14424/05/201846
14525/05/201818
14626/05/201883
14727/05/201887
14828/05/201891
14929/05/201882
15030/05/201837
15131/05/201878
1521/06/201873
1532/06/201823
1543/06/201816
1554/06/201892
1565/06/201831
1576/06/201824
1587/06/201881
1598/06/20187
1609/06/201863
16110/06/2018100
16211/06/201871
16312/06/201812
16413/06/201821
16514/06/201825
16615/06/201823
16716/06/201881
16817/06/201842
16918/06/201828
17019/06/201877
17120/06/201891
17221/06/201811
17322/06/201869
17423/06/201859
17524/06/201897
17625/06/201866
17726/06/201879
17827/06/201846
17928/06/201831
18029/06/2018100
18130/06/201851
1821/07/201837
1832/07/201883
1843/07/201888
1854/07/201865
1865/07/201884
1876/07/201822
1887/07/201830
1898/07/201829
1909/07/201811
19110/07/20189
19211/07/20186
19312/07/201891
19413/07/201896
19514/07/201854
19615/07/201899
19716/07/201815
19817/07/201827
19918/07/201822
20019/07/201897
20120/07/201826
20221/07/201874
20322/07/201840
20423/07/201812
20524/07/201834
20625/07/201879
20726/07/201881
20827/07/20187
20928/07/201890
21029/07/20188
21130/07/201864
21231/07/20184
2131/08/201814
2142/08/201888
2153/08/201874
2164/08/201811
2175/08/201873
2186/08/201894
2197/08/201827
2208/08/201822
2219/08/20187
22210/08/201899
22311/08/201879
22412/08/201837
22513/08/201820
22614/08/201833
22715/08/201835
22816/08/201826
22917/08/20182
23018/08/201861
23119/08/201821
23220/08/201812
23321/08/20185
23422/08/201879
23523/08/201895
23624/08/201821
23725/08/201810
23826/08/20186
23927/08/201858
24028/08/2018100
24129/08/201851
24230/08/201869
24331/08/201882
2441/09/20185
2452/09/201868
2463/09/201853
2474/09/201810
2485/09/20188
2496/09/201892
2507/09/201886
2518/09/201874
2529/09/20181
25310/09/201837
25411/09/201819
25512/09/201845
25613/09/20183
25714/09/201842
25815/09/201860
25916/09/201816
26017/09/201875
26118/09/201810
26219/09/201823
26320/09/201819
26421/09/201873
26522/09/201889
26623/09/201872
26724/09/201811
26825/09/201835
26926/09/201816
27027/09/201845
27128/09/201869
27229/09/201882
27330/09/201839
2741/10/201881
2752/10/201885
2763/10/201845
2774/10/201820
2785/10/20189
2796/10/201835
2807/10/201881
2818/10/201881
2829/10/201844
28310/10/201857
28411/10/201837
28512/10/20185
28613/10/201830
28714/10/201822
28815/10/201879
28916/10/201890
29017/10/201835
29118/10/201899
29219/10/201868
29320/10/201839
29421/10/201889
29522/10/201883
29623/10/201843
29724/10/201828
29825/10/2018100
29926/10/201860
30027/10/201829
30128/10/201875
30229/10/201830
30330/10/201866
30431/10/201811
3051/11/201858
3062/11/201844
3073/11/201874
3084/11/201895
3095/11/201836
3106/11/201872
3117/11/20189
3128/11/201813
3139/11/201885
31410/11/201822
31511/11/20184
31612/11/201861
31713/11/201870
31814/11/201852
31915/11/201890
32016/11/201890
32117/11/201815
32218/11/201891
32319/11/201819
32420/11/201835
32521/11/201828
32622/11/201883
32723/11/201814
32824/11/201812
32925/11/201838
33026/11/201866
33127/11/20182
33228/11/201822
33329/11/201877
33430/11/201815
3351/12/20189
3362/12/201832
3373/12/201851
3384/12/201873
3395/12/201843
3406/12/201883
3417/12/201821
3428/12/2018100
3439/12/201866
34410/12/201893
34511/12/201851
34612/12/201828
34713/12/201868
34814/12/201824
34915/12/201846
35016/12/201862
35117/12/201854
35218/12/201822
35319/12/201816
35420/12/201833
35521/12/201882
35622/12/201836
35723/12/201834
35824/12/201871
35925/12/20181
36026/12/201844
36127/12/201854
36228/12/201858
36329/12/201816
36430/12/201895
36531/12/201882
3661/01/201988
3672/01/2019100
3683/01/201991
3694/01/201964
3705/01/201944
3716/01/201949
3727/01/201960
3738/01/201911
3749/01/201991
37510/01/201991
37611/01/201915
37712/01/201985
37813/01/201921
37914/01/20194
38015/01/201919
38116/01/201924
38217/01/201951
38318/01/201913
38419/01/201919
38520/01/201985
38621/01/201984
38722/01/201917
38823/01/201961
38924/01/201976
39025/01/201940
39126/01/201972
39227/01/201988
39328/01/201992
39429/01/201936
39530/01/201977
39631/01/201928
3971/02/201980
3982/02/20191
3993/02/201979
4004/02/201930
4015/02/201991
4026/02/201960
4037/02/201969
4048/02/201991
4059/02/20192
40610/02/20191
40711/02/201941
40812/02/201915
40913/02/201930
41014/02/201981
41115/02/201985
41216/02/201963
41317/02/20192
41418/02/201916
41519/02/201992
41620/02/201943
41721/02/201977
41822/02/201952
41923/02/201997
42024/02/201927
42125/02/201958
42226/02/201952
42327/02/201986
42428/02/201987
4251/03/201930
4262/03/201980
4273/03/201962
4284/03/201949
4295/03/20199
4306/03/201944
4317/03/201989
4328/03/201986
4339/03/20196
43410/03/201966
43511/03/20195
43612/03/20197
43713/03/20197
43814/03/201983
43915/03/201950
44016/03/201920
44117/03/201911
44218/03/201928
44319/03/201910
44420/03/20198
44521/03/201945
44622/03/201911
44723/03/201964
44824/03/201962
44925/03/201946
45026/03/201926
45127/03/201999
45228/03/201998
45329/03/201945
45430/03/201981
45531/03/201999
4561/04/201927
4572/04/201973
4583/04/201920
4594/04/201981
4605/04/201989
4616/04/201996
4627/04/201930
4638/04/20195
4649/04/20193
46510/04/201925
46611/04/201972
46712/04/201942
46813/04/201978
46914/04/201977
47015/04/201924
47116/04/201926
47217/04/201931
47318/04/201983
47419/04/201918
47520/04/201932
47621/04/201987
47722/04/201986
47823/04/201926
47924/04/201980
48025/04/201920
48126/04/201967
48227/04/20198
48328/04/201942
48429/04/201920
48530/04/20196
Sheet1
Cell Formulas
RangeFormula
C1C1=MAX(INDEX((MONTH(date)=3)*(YEAR(date)=2018)*Value,0))
B452:B485,B91:B450,B1:B59B1=RANDBETWEEN(1,100)
B60:B90B60=RANDBETWEEN(1,80)
Named Ranges
NameRefers ToCells
date=Sheet1!$A$1:$A$1461C1
Value=Sheet1!$B$1:$B$1461C1
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Change formula at C1 to:
Excel Formula:
=MAX(INDEX((MONTH(date)=3)*Value,0))
 
Upvote 0
Solution
Change formula at C1 to:
Excel Formula:
=MAX(INDEX((MONTH(date)=3)*Value,0))
Wow! What an anticlimax :) !
It works great!
You saved my day! Thank you so much for that suggestion. I had no idea it was going to be that simple.
Much appreciated maabadi (and of course also Dave Patton).
You are truly Excel experts!
 
Upvote 0
And for finding first date. try this formula with CTRL+SHIFT+ENTER
Excel Formula:
=INDEX(date,MATCH(1,(MONTH(date)=3)*(Value=C1),0))
 
Upvote 0
Quote The maximum value for March over all the years.

You have the maximum value for March for each year on the Report Sheet; therefore,
you can secure the Max over all years from similar formulas but on the Report Sheet.

T202105a.xlsm
ABCDE
1
2 --- Month ---Max °CDate
3January1Jan-21253-Jan-21
4February2Feb-212419-Feb-21
5March3Mar-21296-Mar-21
6April4Apr-21325-Apr-21
7May5May-212818-May-21
8January13Jan-22167-Jan-22
9February14Feb-22272-Feb-22
10March15Mar-22405-Mar-22
11
12
13
14
15By Month
16January253-Jan-21
17February272-Feb-22
18March405-Mar-22
19
Report_a
Cell Formulas
RangeFormula
A3:A10A3=TEXT(C3,"mmmm")
B3:B10B3=MONTH(C3)+(YEAR(C3)-YEAR($C$3))*12
D3:D10D3=INDEX(Data!$D$3:$D$23,MATCH(B3,Data!$B$3:$B$23))
E3:E10E3=INDEX(Data!$E$3:$E$23,MATCH(B3,Data!$B$3:$B$23))
D16:D18D16=AGGREGATE(14,6,$D$3:$D$10/($A$3:$A$10=A16),1)
E16:E18E16=AGGREGATE(14,6,$E$3:$E$10/($D$3:$D$10=D16)*($A$3:$A$10=A16),1)
 
Upvote 0
Food for thought Dave.
Thanks for that.
However, in my weather data collection I've got multiple sensors to monitor. So, there will be many formulas to add.
But I see that your solution could be very useful as it will show the extremes for each month and for each year.
I can then add a search function on these max and min values and the result could then be published on the dashboard.
Anyway, I've got lots of experimenting to do :)
Cheers and all the best!
Luke
 
Upvote 0
Could I trouble you one more time please?
Based on the formula as suggested above I now want to find the maximum total value for each month over the years.
Here's a table to explain:
Rainfall over the years per month.JPG

I've written following formula:

=SUM(INDEX((MONTH(Date)=1)*RG203mm,0))

However that returns the sum of rainfall for every January month (Which is 473.3mm).
The result I would like to see is 159.2 as this was the January month with the highest amount of rainfall.
It seems I'm on the right track but I need a little assistance to make this work.
After the result is published I also want to see the month and the year it happened; Is that possible?
Many thanks in advance!
Luke
 
Upvote 0
Why you don't use the only MAX function.
If the January month data is in Row 2 then:
Excel Formula:
=MAX(B2:N2)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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