Solved

Find the highest number in a dynamic range

Posted on 2015-01-24
6
70 Views
Last Modified: 2015-01-25
I am trying to create a formula that finds the highest number in a dynamic range.  For example if I put the formula in B10 it would be = MAX($B$5:B9). If I put the formula in B18 it would be = MAX($B$5:B17).   The formula I am trying to create is = MAX($B$5 : "To the cell above the one in which I am entering the formula").  The cells in the range are a mix of blanks and numbers.

Any help would be appreciated.
0
Comment
Question by:elimishia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 

Author Comment

by:elimishia
ID: 40568836
I have just realized that by just using a relative reference, the range is automatically dynamic  =SUM($B$5:B9) - unless there is a better way.  thanks
0
 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 40568940
one way to do this without using named ranges is  =MAX(INDIRECT("B$5:B"&COUNTA(B:B)))

but if your data has blanks then this would not be of help in that case you have to use named range like the formula below


Create a named range put the this formula and name it   "LastRow"
=LOOKUP(9.99999999999999E+307,1/(1-ISBLANK(Sheet1!$B:$B)),ROW(Sheet1!$B:$B))


Create another named range and put this formula and name it "Mydynamicrange"
=Sheet1!$B$5:INDEX(Sheet1!$B:$B,LastRow)

then your formula Max will work, and as you add more numbers in Column B, the dynamic range will take care of the new dada and you do not have to change anything inside Max formula.

=MAX(Mydynamicrange)
0
 

Author Comment

by:elimishia
ID: 40569038
Thank-you. However, the formula is returning 0 (the highest number is 36) and I am getting an alert about circular references.
Because I have blanks in the column I used your suggestion of two named ranges.
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 40569043
Two issues,

What is the sheet name that has values in B column?

If it is not Sheet1
Then either rename sheet or change the sheet1 in the dynamic range names and put the correct sheet name.

You are getting circular reference error because you have put the max formula in column B
Do not put the = max in column B put it somewhere else let's say put it in C 1
Then  it should work
0
 
LVL 5

Accepted Solution

by:
Hakan Yılmaz earned 500 total points
ID: 40569259
You can use OFFSET function.
=MAX(OFFSET($B$5,0,0,ROW()-ROW($B$5),1)).

Or only using INDIRECT function.
=MAX(INDIRECT("R[-1]C:R5C";FALSE))
0
 

Author Closing Comment

by:elimishia
ID: 40569828
Sweet!  Both formulae worked brilliant.  Exactly what I was looking for.  Thank-you.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question