+ Reply to Thread
Results 1 to 4 of 4

How can I select a specific value between two dates based on other criteria

  1. #1
    Registered User
    Join Date
    01-29-2012
    Location
    Christchurch, New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    3

    How can I select a specific value between two dates based on other criteria

    Hi There,

    How can you select values in a table between two dates, that also meet other criteria?

    In the table I have the columns "Start date", "Role", "Ward" and "Activity".

    I wish to find the lowest "Start date" larger than 'x' but less than'x+1' (interger day) which also has a "Role" equal to 'a', "Ward" equal to 'b' and "Activity" equal to 'c'

    The values for 'x', 'a', 'b', and 'c' are all user defined in another sheet via dropdown lists, while the table is linked to a SQL database.

    Any help would be great.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: How can I select a specific value between two dates based on other criteria

    Post a workbook, no one wants to create one by guessing at your data/layout.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    01-29-2012
    Location
    Christchurch, New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How can I select a specific value between two dates based on other criteria

    Hey There,

    Simplified file attached (hopefully work as first timer) - Anyway I am trying to set B6 (in red) to the lowest startdatetime based on the following criteria for the Table in Sheet2:

    Ward = A3
    Role = B3
    Activity = C3
    A5 < Startdatetime < A5+1

    Thanks
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: How can I select a specific value between two dates based on other criteria

    Try this with CTRL+SHIFT+ENTER, rather than just ENTER

    =MOD(MIN(IF((Sheet2!$A$2:$A$494=A$3)*(Sheet2!$B$2:$B$494=B$3),IF(Sheet2!$C$2:$C$494=$C$3,Sheet2!$D$2:$D$494))),1)
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  5. #5
    Registered User
    Join Date
    01-29-2012
    Location
    Christchurch, New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How can I select a specific value between two dates based on other criteria

    Haseeb A

    Your formula returns the first value in the 'StartDateTime' column, not the first value in the column greater than cell A5 - the attached spreadsheet was a simplified version of the spreadsheet I am working in - there are multiple dates and all criteria need to be included.

    Have tried the example below which worked fine - thanks heaps for the help.

    =MOD(MIN(IF((Sheet2!$A$2:$A$494=A$3)*(Sheet2!$B$2:$B$494=B$3)*(Sheet2!$D$2:$D$494>A$5),IF(Sheet2!$C$2:$C$494=$C$3,Sheet2!$D$2:$D$494))),1)

+ 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