Closed Thread
Results 1 to 5 of 5

Finout max value against given date

  1. #1
    Registered User
    Join Date
    04-26-2007
    Posts
    77

    Finout max value against given date

    Dear Experts

    In my Worksheet ("Date") I have following two columns as

    Code-----Date---
    --1----01/05/07
    --3----01/05/07

    --5----15/05/07
    --6----15/05/07
    --7----15/05/07

    --4----03/05/07
    --1----05/05/07
    --5----04/05/07
    --4----03/05/07

    How to findout Maximum Code in column A against Date=15/05/07
    The answer is =7

    Note: Date format is ("dd-mm-yy") 'British date

    Please help

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444
    Hi,

    Use an array formula like so,

    =MAX(IF(date_range=date,data_range,"")) [confirm with CTRL, SHIFT & ENTER]

    It may be wise to use a cell reference to reference the date to ensure you're checking for the right this, viz

    eg

    =MAX(IF(B1:B8=D1,A1:A8,""))
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    04-26-2007
    Posts
    77
    Dear Sir,

    Your followong array formula work fine within a cell
    {=MAX(IF(B1:B8=D1,A1:A8,""))}

    But when I use it under command button as follows
    Please Login or Register  to view this content.
    then it show error message
    Run-Time Error 9
    Subscript out of range

    Please modify, how to use with command button

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444
    I think you'll have to either, perform the array loop in your VBA code, or apply the .FormulaArray method

    Dave

  5. #5
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    tqm1, please read these rules!, you have had assistance with your problem and still saw fit to cross post to another forum without in forming either them or the people that have been kind enough to help you here!

    Cross posted here

    This thread is now locked, read the rules if you agree to abide by them send a PM to one of the moderators of this site and your thread will be made active again
    Not all forums are the same - seek and you shall find

Closed 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