Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
dan dan is offline
external usenet poster
 
Posts: 866
Default Find Max from Variable Range

I have the following spreadsheet and want to find the maximum number in a
variable range based on the value of a cell - 3 rows.


A1 B1

45 7
66
43
22
11
22


In the above data I would like to find the max of A4:A7 because 7 is entered
into the cell of A3B3 (7 - 3). The value of A3B3 will change so the range I
need to have max of will change also.

Thanks in advance - Dan
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Find Max from Variable Range

I'm assuming that you'll be entering valid numbers in B3. For example, based
on your sample if you enter a number <4 in B3 then you'll get an error. So,
with that assumption:

=IF(B3="","",MAX(INDIRECT("A"&B3-3&":A"&B3)))


--
Biff
Microsoft Excel MVP


"Dan" wrote in message
...
I have the following spreadsheet and want to find the maximum number in a
variable range based on the value of a cell - 3 rows.


A1 B1

45 7
66
43
22
11
22


In the above data I would like to find the max of A4:A7 because 7 is
entered
into the cell of A3B3 (7 - 3). The value of A3B3 will change so the range
I
need to have max of will change also.

Thanks in advance - Dan



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Find Max from Variable Range

Another way you could do it
=IF(B33,MAX(INDEX(A:A, B3-3):INDEX(A:A, B3)),"")

"Dan" wrote:

I have the following spreadsheet and want to find the maximum number in a
variable range based on the value of a cell - 3 rows.


A1 B1

45 7
66
43
22
11
22


In the above data I would like to find the max of A4:A7 because 7 is entered
into the cell of A3B3 (7 - 3). The value of A3B3 will change so the range I
need to have max of will change also.

Thanks in advance - Dan

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
dan dan is offline
external usenet poster
 
Posts: 866
Default Find Max from Variable Range

JMB,

This works great!! So does T. Solutions. Thank you both. Could I bother you
to explain the syntax though? I would like to understand the
formula...specifically the A:A ???

Thanks - Dan

"JMB" wrote:

Another way you could do it
=IF(B33,MAX(INDEX(A:A, B3-3):INDEX(A:A, B3)),"")

"Dan" wrote:

I have the following spreadsheet and want to find the maximum number in a
variable range based on the value of a cell - 3 rows.


A1 B1

45 7
66
43
22
11
22


In the above data I would like to find the max of A4:A7 because 7 is entered
into the cell of A3B3 (7 - 3). The value of A3B3 will change so the range I
need to have max of will change also.

Thanks in advance - Dan

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Find Max from Variable Range

A:A refers to all of column A. It is the same as A1:A65536 (pre XL2007)

If B3 is 7 then
=IF(B33,MAX(INDEX(A:A, 4):INDEX(A:A, 7)),"")

Index returns the nth cell from column A
=IF(B33,MAX(A4:A7),"")

although I will point out that without the initial test of B33 and B3
happens to be 3, then the first index function becomes
Index(A:A, 0)
which will return the entire column A - which is sometimes a useful feature
of Index. This would not be a problem with Biff's formula (you'd get an
error as the range reference fed to the Indirect function would be A0:A3 and
is invalid).

Although if you insert a new column and shift column A to the right (so now
it is column B), the Indirect function in Biff's post will still reference
column A (XL would not change the formula automatically to reference column
B).


"Dan" wrote:

JMB,

This works great!! So does T. Solutions. Thank you both. Could I bother you
to explain the syntax though? I would like to understand the
formula...specifically the A:A ???

Thanks - Dan

"JMB" wrote:

Another way you could do it
=IF(B33,MAX(INDEX(A:A, B3-3):INDEX(A:A, B3)),"")

"Dan" wrote:

I have the following spreadsheet and want to find the maximum number in a
variable range based on the value of a cell - 3 rows.


A1 B1

45 7
66
43
22
11
22


In the above data I would like to find the max of A4:A7 because 7 is entered
into the cell of A3B3 (7 - 3). The value of A3B3 will change so the range I
need to have max of will change also.

Thanks in advance - Dan



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
dan dan is offline
external usenet poster
 
Posts: 866
Default Find Max from Variable Range

How about the ,"" on the end?
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Find Max from Variable Range

if b3 is <= 3 then IF will return an empty string - making the cell "blank"

"Dan" wrote:

How about the ,"" on the end?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cells.Find with a variable El Bee Excel Discussion (Misc queries) 4 January 28th 08 09:30 PM
Right Text - Variable Find Karin Excel Discussion (Misc queries) 2 June 7th 07 03:24 PM
find a variable text string [email protected] Excel Discussion (Misc queries) 2 January 30th 07 07:20 PM
3 variable find and replace ncspndoc Excel Discussion (Misc queries) 4 June 30th 06 09:07 PM
How do I find the last row of data and then use that as a variable Lynn Bales New Users to Excel 3 August 4th 05 12:51 PM


All times are GMT +1. The time now is 02:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"