Return maximum whole number from column of data

Frog1

New Member
Joined
Dec 31, 2024
Messages
3
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Greetings All!

I have a column of data (column A) in which there are whole numbers (1,2,3...etc) and other numbers that may be negative and contain decimal points. I attach a sample of the data. Can someone help with an excel formula that would return the maximum whole number and NOT to include any negative number or that contains a decimal point and then add '1' to this maximum number and paste it below the data column of interest. eg from the sample data the maximum whole number value is '7' [from row 53] -- therefore I wish to insert the number '8' into cell A61. One may notice that the data column follows a similar pattern: there is a 'blank' cell followed by a whole number then three more 'blank' cells then a varying number of cells that contain negative numbers and/or numbers with decimal points, then a blank cell and the pattern is repeated. NB these are blank cells are not empty but contain a formula. I hope I have managed to explain the question clearly and....oh yes "A Happy New Year"


A
1
21
3
4
5
63.26
77.806
8
92
10
11
12
13-0.74
142.413
1513.04
1610.72
17
183
19
20
21
2213.98
23-0.08
246.376
2516.54
2611.94
27
284
29
30
31
3210.05
33
345
35
36
37
3824.93
399.227
405.226
41-1.7
42
436
44
45
46
47-2.94
483.71
496.15
503.744
515.092
52
537
54
55
56
579.77
586.466
5911.36
60
61
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
If you want "all in one" formula and have old (2016 or '13) version of Excel my proposition for B1 and coy down is an array * formula:
Excel Formula:
=IF(INDEX(A$1:A$100,MAX(1,ROW()-MAX(IF(A$1:A$100=INT(A$1:A$100),A$1:A$100,""))-1))=MAX(IF(A$1:A$100=INT(A$1:A$100),A$1:A$100,"")),MAX(IF(A$1:A$100=INT(A$1:A$100),A$1:A$100,""))+1,"")


To have array formula active in older versions of Excel, like yours you shall paste the formula to formula bar or to a cell but not commit it with just Enter but with Ctrl+Shift+Enter combination.
If you look into formula bar after that, you will see the formula surrounded by curly braces. But you can't write them from the keybord. These curly braces have to be result of pressing Ctrl+Shift+Enter keys combination.
 
Upvote 0
Another option:

Excel Formula:
=AGGREGATE(14,6,(TRUNC(A2:A60,0)=A2:A60)*A2:A60,1)+1
 
Upvote 0
Solution
@hagia_sophia : But this will only calculate 8 wherever it is posted, not positioning the result only in row 61
 
Upvote 0
If you use the above AGGREGATE formula (or equivalent to it array committed formula):
Excel Formula:
=MAX(IF(A$1:A$100=INT(A$1:A$100),A$1:A$100,""))+1
and one of these formulas is in E1, you can write in B1 and copy down such standard (just Enter committed) formula:
Excel Formula:
=IF(INDEX(A$1:A$100,MAX(1,ROW()-E$1))=E$1-1,E$1,"")

See all formulas in action in columns B, C and D of this mini-sheet (C and D refer to E1 and F1 resp.):

Book1
ABCDEF
1   88
21   
3   
4   
5   
63,26   
77,806   
8   
92   
10   
11   
12   
13-0,74   
142,413   
1513,04   
1610,72   
17   
183   
19   
20   
21   
2213,98   
23-0,08   
246,376   
2516,54   
2611,94   
27   
284   
29   
30   
31   
3210,05   
33   
345   
35   
36   
37   
3824,93   
399,227   
405,226   
41-1,7   
42   
436   
44   
45   
46   
47-2,94   
483,71   
496,15   
503,744   
515,092   
52   
537   
54   
55   
56   
579,77   
586,466   
5911,36   
60   
61888
62   
63   
Sheet2
Cell Formulas
RangeFormula
B1:B63B1=IF(INDEX(A$1:A$100,MAX(1,ROW()-MAX(IF(A$1:A$100=INT(A$1:A$100),A$1:A$100,""))-1))=MAX(IF(A$1:A$100=INT(A$1:A$100),A$1:A$100,"")),MAX(IF(A$1:A$100=INT(A$1:A$100),A$1:A$100,""))+1,"")
C1:C63C1=IF(INDEX(A$1:A$100,MAX(1,ROW()-E$1))=E$1-1,E$1,"")
D1:D63D1=IF(INDEX(A$1:A$100,MAX(1,ROW()-F$1))=F$1-1,F$1,"")
E1E1=MAX(IF(A$1:A$100=INT(A$1:A$100),A$1:A$100,""))+1
F1F1=AGGREGATE(14,6,(TRUNC(A2:A60,0)=A2:A60)*A2:A60,1)+1
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
@hagia_sophia : But this will only calculate 8 wherever it is posted, not positioning the result only in row 61

@Kaper: you are right; my understanding of the question was that there is a set of data and the formula should be right below it but it might be a wrong reading.
 
Upvote 0
As I understand, if there is no data in A18 and below, the result shall be 3, and shall be located in row 12 (3 rows below value 2 in A9)
 
Upvote 0
If you want "all in one" formula and have old (2016 or '13) version of Excel my proposition for B1 and coy down is an array * formula:
Excel Formula:
=IF(INDEX(A$1:A$100,MAX(1,ROW()-MAX(IF(A$1:A$100=INT(A$1:A$100),A$1:A$100,""))-1))=MAX(IF(A$1:A$100=INT(A$1:A$100),A$1:A$100,"")),MAX(IF(A$1:A$100=INT(A$1:A$100),A$1:A$100,""))+1,"")


To have array formula active in older versions of Excel, like yours you shall paste the formula to formula bar or to a cell but not commit it with just Enter but with Ctrl+Shift+Enter combination.
If you look into formula bar after that, you will see the formula surrounded by curly braces. But you can't write them from the keybord. These curly braces have to be result of pressing Ctrl+Shift+Enter keys combination.
Hi Kaper

Thank you for this response. I will get to trying your idea as soon as the New Year festivities have slowed down. I do appreciate the quick reply -- in fact I am amazed at the responses during this holiday season

Frog1
 
Upvote 0
Celebrating New Year's Eve and New Year not only by partying but also by pursuing a hobby is a good idea after all, isn't it? :-D
BTW, yesterday afternoon and today morning I was biking too, so continuity between 2024 and 2025 is fully maintained <3
 
Upvote 0

Forum statistics

Threads
1,225,316
Messages
6,184,247
Members
453,223
Latest member
Ignition04

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