Require formula

Ron99

Active Member
Joined
Feb 10, 2010
Messages
347
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I have data in rows

I need a max formula for the last 12 consecutive months.Formula should calculate value more than zero and the calculation should start from right.

Formula result should show For RON its 24 & Jude its 9.

[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]J[/TD]
[TD]F[/TD]
[TD]M[/TD]
[TD]A[/TD]
[TD]M[/TD]
[TD]J[/TD]
[TD]J[/TD]
[TD]A[/TD]
[TD]S[/TD]
[TD]O[/TD]
[TD]N[/TD]
[TD]D[/TD]
[TD]J[/TD]
[TD]F[/TD]
[TD]M[/TD]
[TD]A[/TD]
[TD]M[/TD]
[TD]J[/TD]
[TD]J[/TD]
[TD]A[/TD]
[TD]S[/TD]
[TD]O[/TD]
[TD]N[/TD]
[TD]D[/TD]
[TD]J[/TD]
[TD]F[/TD]
[TD]M[/TD]
[TD]A[/TD]
[TD]M[/TD]
[TD]J[/TD]
[TD]J[/TD]
[TD]A[/TD]
[TD]S[/TD]
[TD]O[/TD]
[TD]N[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]RON[/TD]
[TD]12[/TD]
[TD]2[/TD]
[TD]0[/TD]
[TD]8[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]6[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]8[/TD]
[TD]9[/TD]
[TD]4[/TD]
[TD]8[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]6[/TD]
[TD]8[/TD]
[TD]9[/TD]
[TD]24[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]3[/TD]
[TD]6[/TD]
[TD]1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]JUDE[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]2[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]9[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]2[/TD]
[TD]5[/TD]
[TD]8[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]9[/TD]
[TD]5[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]2[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Book1
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKAL
1JFMAMJJASONDJFMAMJJASONDJFMAMJJASOND
224RON12208000062389480000000001689240013610
39JUDE002569000000000000000000025800950023
Sheet1


In A2 control+shift+enter, not just enter, and copy down:

=MAX(IF(COLUMN(C2:AL2)>=LARGE(IF(ISNUMBER(1/C2:AL2),COLUMN(C2:AL2)),MIN(12,COUNTIFS(C2:AL2,">0"))),IF(ISNUMBER(1/C2:AL2),C2:AL2)))
 
Upvote 0
Excellent!! that worked. With the same scenario I have one more requirement.

I need a formula for the max 12 month in this range

max(sum(C2:N2),SUM(D2:O2),SUM(E2:P2)..and so on

Is there a better formula As I have range for 5 years by month.

Thanks,
Ron
 
Last edited:
Upvote 0
Excellent!! that worked.

Great.

With the same scenario I have one more requirement.

I need a formula for the max 12 month in this range

max(sum(C2:N2),SUM(D2:O2),SUM(E2:P2)..and so on

Is there a better formula As I have range for 5 years by month.

[…]

I don't understand the request neither the formula you provide as a description. Care to elaborate? Use a 3 months window instead of 12 for reasons of an easier explanation and layout.
 
Upvote 0
... I need a formula for the max 12 month in this range

max(sum(C2:N2),SUM(D2:O2),SUM(E2:P2)..and so on

Is there a better formula As I have range for 5 years by month...
See if the following array formula (to be entered using Ctrl+Shift+Enter, not just Enter) works for you:

=MAX(SUBTOTAL(9,OFFSET($C2,,ROW(INDIRECT("1:"&COUNT($C2:$ABC2)-11))-1,1,12)))
 
Upvote 0
For the original problem I think you could also use this standard-entry formula.
(If there is a row consisting of all 0 values this formula will return 0. If that is possible with your data and is a problem result for you, an amendment could be made)

Excel Workbook
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKAL
1JFMAMJJASONDJFMAMJJASONDJFMAMJJASOND
224RON12208000062389480000000001689240013610
39JUDE002569000000000000000000025800950023
Max
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
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