+ Reply to Thread
Results 1 to 6 of 6

INDIRECT MAX with criteria (variable range length)

  1. #1
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    INDIRECT MAX with criteria (variable range length)

    Hello experts,

    I got the below formula to find MAX date when meet a criteria:-

    =IF($P2="","",MAX(IF($A3:$A$9999=$A2,$P3:$P$9999))) with Ctrl+Shift+Enter

    However, I have a situation where the last row of the range is variable.. meaning, it may not be only row 9999. And the start row of the range must always follow the row below the current row (where the formula is applied). It will grow for day to day, as the data will be added on daily basis. When I tried to change as below, I got error #VALUE!. Can anybody correct me, please?

    =IF(INDIRECT("$P"&ROW())="","",MAX(IF(INDIRECT("$A"&ROW()+1&":$A$"&COUNT(A:A))=INDIRECT("$A"&ROW()),INDIRECT("$A"&ROW()+1&":$A$"&COUNT(A:A))))) with Ctrl+Shift+Enter

    Thank you in advance.

    DZ

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: INDIRECT MAX with criteria (variable range length)

    Try this one

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: INDIRECT MAX with criteria (variable range length)

    Hello AlKey,

    I can't put a fix start range for A as A3 and P as P3 because the range must start from the row below the current row. Your formula will only return the first max date from column P.

    Thanks.

    DZ

  4. #4
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: INDIRECT MAX with criteria (variable range length)

    Hi,

    Aladin Akyurek from MrExcel forum has given me the solution as below:-

    In A1 enter:

    =MATCH(9.99999999999999E+307,P:P)

    Now invoke: Control+shift+enter...

    =IF($P2="","",MAX(IF($A3:INDEX($A:$A,$A$1)=$A2,$P3:INDEX($P:$P,$A$1))))

    This adjusts automatically to the changing ranges.

    ---------------------------------------

    My problem solved! Thanks!

  5. #5
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: INDIRECT MAX with criteria (variable range length)

    Wow, that's much simpler than mine
    I found that you can't use ROW() in an array....so I cheated with:

    =IF(INDIRECT("P"&CELL("row",R2))="","",MAX(IF(INDIRECT("A"&CELL("row",R3)&":A"&CELL("row",R3)+9999)=INDIRECT("A"&CELL("row",R2)),INDIRECT("P"&CELL("row",R3)&":P"&CELL("row",R3)+9999))))

  6. #6
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: INDIRECT MAX with criteria (variable range length)

    Cross posting under different names without links ... http://www.mrexcel.com/forum/excel-q...ge-length.html

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] copy range with variable length
    By Coleman34 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2014, 01:07 PM
  2. Replies: 3
    Last Post: 11-07-2012, 10:26 AM
  3. [SOLVED] Creating a variable length report based on criteria in previous worksheet
    By lizziebusy in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 04-05-2012, 03:00 PM
  4. Conditional formatting of range of variable length
    By tinkerbelle in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-01-2009, 08:36 AM
  5. Variable Range Length & .FillDown?
    By Jason Paris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-02-2006, 03:10 AM
  6. [SOLVED] Variable series length/range
    By JessK in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-03-2006, 12:10 AM
  7. [SOLVED] RE: Copying RANGE of variable length
    By Jim Thomlinson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-19-2005, 01:05 PM

Tags for this Thread

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