+ Reply to Thread
Results 1 to 4 of 4

Variable range in MAX-function

  1. #1
    Forum Contributor
    Join Date
    08-22-2005
    Location
    Denmark
    MS-Off Ver
    Excel 365
    Posts
    349

    Variable range in MAX-function

    I need to use the largest figure in a part of column D. The part is defined with the lowest value of the range always being D2 and the highest being determined by the number of used cells in column B, eg. if column B contains 32 used cells then the range is (D2:D31)

    I tried this formula:
    =MAX(D2:ADDRESS(COUNT(B:B)-1;4;4))+1
    but I cannot enter it. I get a message that it contains an error, just as if I've forgotten a parenthesis or something like that.

    I have tested the formula =ADDRESS(COUNT(B:B)-1;4;4) in spare cell in the sheet where it works fine and writes D31 when there are 32 used cells in column B.
    Why doesn't it work in the MAX formual?

    NSV

  2. #2
    Registered User
    Join Date
    02-06-2006
    Posts
    42
    Well the first thing I'd say is that the second part doesn't have a column reference:

    =MAX(D2: 'need some reference to D here' ADDRESS(COUNT(B:B)-1;4;4))+1

    Not quite sure how you do that though.

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065
    This will work

    =MAX(INDIRECT(CONCATENATE("D1:D",COUNTA(B1:B1000))))

    unless you have blank cells in column D

    More info here

    http://www.grbps.com/Excel7.pdf
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Contributor
    Join Date
    08-22-2005
    Location
    Denmark
    MS-Off Ver
    Excel 365
    Posts
    349
    I do have blank cells in D and it does not work.

    Is there perhaps a VBA solution?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1