Range row based on criteria

hstef

New Member
Joined
Nov 19, 2018
Messages
39
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I am trying to max value a range, based on criteria for the range row, and everything I tried so far doesn't work, so your help will be greatly appreciated.
Ex:
Sheet1
A1:A200 = 02:00:00 AM, 03:00:00 AM, 04:00:00 AM, 05:00:00 AM...etc
B1:B200 = values

Sheet2
A1= 04:00:00 AM
B1=Sheet name (Sheet1)
C1= Max formula (=MAX(INDIRECT("'"&B1&"'!"&"B3:B200"))

I need the formula to max value to corespondent range.
If A1=02:00:00 AM, then the range for max values to be B1:B200
If A1=04:00:00 AM, then the range for max values to be B3:B200
....etc

It would really help to change only the value in A1 and the formula to work with the new range, according to the A1 criteria.
I only need to change the starting row of the range( B1, B2,...etc.

Can this be done in just one formula? I am trying to avoid using too many formulas to retrieve cell and column numbers.

Thank you in advance,
Stef.
 
Thank you etaf, but I am looking for just one formula if possible.

Thank you for your efforts.
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
isnt this
=MAX(INDIRECT("'"&B1&"'!"&ADDRESS(MATCH(ROUND(Sheet2!A1,15),ROUND(A1:A200,15),0),2)&":B200"))
one formula ?
E3 on my example
 
Upvote 0
Solution
Yes, it is, thank you!
I didn't manage to make it work until I use ctrl+shift+enter.

It's working now, and it is what I needed.

Thank you again for your formula and patience.
Stef.
 
Upvote 0
Yes, its an array formula, should ha e mentioned as with the later versions of excel it works it out for you.

as i say it may not work for all instances you are after

But glad its sorted at the moment
 
Upvote 0
Yes, its an array formula, should ha e mentioned as with the later versions of excel it works it out for you.

as i say it may not work for all instances you are after

But glad its sorted at the moment
Hi Etaf,

I am having trouble adjusting your formula.
If I move the formula to sheet 2, it doesn't work.

In sheet1, I have only hours and values.
In sheet2 I have lookup hour (02:10:00), indirect sheet(Sheet1), and your formula.

Look at my previous post to understand better my sheets layout: Range row based on criteria

Can you help me adjust it?
Thank you again.
 
Upvote 0
you would need to reference the sheets the ranges are on
at the moment
=MAX(INDIRECT("'"&B1&"'!"&ADDRESS(MATCH(ROUND(Sheet2!A1,15),ROUND(A1:A200,15),0),2)&":B200"))

which assumes the formula is in the sheet with B1, A1:A200 etc
B1 references the Sheet - hence why you used indirect in the first place

if you move the formula to sheet2 and want to reference the ranges in sheet1
=MAX(INDIRECT("'"&Sheet1!B1&"'!"&ADDRESS(MATCH(ROUND(Sheet2!A1,15),ROUND(Sheet1!A1:A100,15),0),2)&":B200"))

Book2
ABCDEFG
102:10:00Result
290
3
Sheet2
Cell Formulas
RangeFormula
F2F2=MAX(INDIRECT("'"&Sheet1!B1&"'!"&ADDRESS(MATCH(ROUND(Sheet2!A1,15),ROUND(Sheet1!A1:A100,15),0),2)&":B200"))


The reference for B1 what sheet to use is still in sheet1
So now we have to reference that cell B1 in sheet1 (to get the value - which happens to be sheet1
and then add sheet1 and 2 to the other references
BUT then you may need the indirect for the 2nd Sheet1 in the round for the A?:B200
 
Upvote 0
you would need to reference the sheets the ranges are on
at the moment
=MAX(INDIRECT("'"&B1&"'!"&ADDRESS(MATCH(ROUND(Sheet2!A1,15),ROUND(A1:A200,15),0),2)&":B200"))

which assumes the formula is in the sheet with B1, A1:A200 etc
B1 references the Sheet - hence why you used indirect in the first place

if you move the formula to sheet2 and want to reference the ranges in sheet1
=MAX(INDIRECT("'"&Sheet1!B1&"'!"&ADDRESS(MATCH(ROUND(Sheet2!A1,15),ROUND(Sheet1!A1:A100,15),0),2)&":B200"))

Book2
ABCDEFG
102:10:00Result
290
3
Sheet2
Cell Formulas
RangeFormula
F2F2=MAX(INDIRECT("'"&Sheet1!B1&"'!"&ADDRESS(MATCH(ROUND(Sheet2!A1,15),ROUND(Sheet1!A1:A100,15),0),2)&":B200"))


The reference for B1 what sheet to use is still in sheet1
So now we have to reference that cell B1 in sheet1 (to get the value - which happens to be sheet1
and then add sheet1 and 2 to the other references
BUT then you may need the indirect for the 2nd Sheet1 in the round for the A?:B200
Hi,

Yes, I need the indirect for the 2nd Sheet1 in the round for the A:B200.
The indirect cell will also be B1.

Thanks. :)
 
Upvote 0

Forum statistics

Threads
1,213,549
Messages
6,114,261
Members
448,558
Latest member
aivin

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