Dynamic ranges

sandra_m

New Member
Joined
Apr 21, 2011
Messages
7
Hello,

I have a sheet called “Calculation” on which column E that contains (from row 4 below) approx. 50 numbers (results from a formula) and somewhere in these 50 numbers one row that contains the text “maximum” (also as a result from a formula).

This formula is for row 4 “=IF(D4=0;"maximum";D4)” and it goes down till the last row.

On column D I have only one zero, so there will be only one “maximum” on column E.

I need 2 dynamic ranges on column E: the first one from row 4 until the row that contains “maximum” and the 2nd one from “maximum” until the last number in the column E (because in the end I need the maximums of the 2 ranges).

Could anyone help me with these ranges? Thanks a lot.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hello Sandra, Try

For range until maximum, This will include maximum

=$D$4:INDEX($D:$D,MATCH("maximum",$D:$D,0))

For range from maximum +1 cell to down last number

INDEX($D:$D,MATCH("maximum",$D:$D,0)+1):INDEX($D:$D,MATCH(1E+100,$D:$D))
 
Upvote 0
Hi,

Named Range 1

=INDEX(E:E,4,0):INDEX(E:E,MATCH("maximum",E:E,0)-1,0)

Named Range 2

=INDEX(E:E,MATCH("maximum",E:E,0),0):INDEX(E:E,MATCH(9.99999E307,E:E),0)
 
Upvote 0
Hello,

I have a sheet called “Calculation” on which column E that contains (from row 4 below) approx. 50 numbers (results from a formula) and somewhere in these 50 numbers one row that contains the text “maximum” (also as a result from a formula).

This formula is for row 4 “=IF(D4=0;"maximum";D4)” and it goes down till the last row.

On column D I have only one zero, so there will be only one “maximum” on column E.

I need 2 dynamic ranges on column E: the first one from row 4 until the row that contains “maximum” and the 2nd one from “maximum” until the last number in the column E (because in the end I need the maximums of the 2 ranges).

Could anyone help me with these ranges? Thanks a lot.
Am I correct in observing that the actual range is in column D and the range in E is constructed from that of D using the formula...

=IF(D4=0;"maximum";D4)

which is entered in E4 and copied down?
 
Upvote 0
Yes, you are correct. Column E contains from row 4 until the last row information from column D, except the row that contains "maximum" (on column D there is a zero instead of maximum).
 
Upvote 0
I tried both solutions and they both are suitable for my requests. Thank you so much for the help you provided.
 
Upvote 0
Yes, you are correct. Column E contains from row 4 until the last row information from column D, except the row that contains "maximum" (on column D there is a zero instead of maximum).

That would mean that you could have the dynamic named ranges constructed
directly from column D (that is, E is not not needed)...

Although there are already two replies defining the required ranges, I'll also do so...

Define Size as referring to:

=MATCH(9.99999999999999E+307;Calculation!$D:$D)

Note 1. 9.99999999999999E+307 can be shortened to: 9.99E+307.

Note 2. If your system requires comma instead of a dot for decimal numbers, replace the dot in that big number with a comma.

Define MaxPos as referring to:

=MATCH(0;Calculation!$D:$D)

Now we can define the two ranges that you require:

Define BeforeMax (or any other more convenient name) as referring to:

=Calculation!$D$4:INDEX(Calculation!$D:$D,MaxPos-1)

Define AfterMax as referring to:

=INDEX(Calculation!$D:$D,MaxPos+1):INDEX(Calculation!$D:$D,Size)
 
Upvote 0
Hi,

I tried this and the values I receive are #N/A. Could this be perhaps because column D contains numbers that are results of a formula? For example, D9=IF(LEN(C9)=0;"";IF(C9=0;0;IF(ISNUMBER(D8);D8+C9;IF(LEN(D8)=0;C9)))).
 
Upvote 0
Hi,

I tried this and the values I receive are #N/A. Could this be perhaps because column D contains numbers that are results of a formula? For example, D9=IF(LEN(C9)=0;"";IF(C9=0;0;IF(ISNUMBER(D8);D8+C9;IF(LEN(D8)=0;C9)))).

Hope you replaced comma's with semi-colons as I was not consistent with the latter...

What do we get if we would try the following:

=IF(ISNUMBER(D9);1;IF(D9="";"#";"@"))
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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