+ Reply to Thread
Results 1 to 8 of 8

find next date based on cell value

  1. #1
    Forum Contributor
    Join Date
    05-30-2014
    Posts
    112

    find next date based on cell value

    I am needing a formula (or VBA) to enter a date that can be found on another sheet based on a number found on the first sheet. the date that would be found and entered would need to be greater than of equal to a date found on the first sheet and would need to be the first one found that met said criteria. attached is the sheet I am working on and an example of the results. The long term goal is to sort by inventory ID and date so that a time line of each ID can be followed line by line. Both data sets are pulled from SQL queries, I just couldn't get it to do what I was needing all in one.

    example.xlsx

  2. #2
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: find next date based on cell value

    =index(Sheet2!$B$2:$B$24960,match(1,(Sheet2!$B$2:$B$24960>$L2)*(Sheet2!$C$2:$C$24960=$G2),))as CSE
    Last edited by tim201110; 12-17-2014 at 03:29 PM.

  3. #3
    Forum Contributor
    Join Date
    05-30-2014
    Posts
    112

    Re: find next date based on cell value

    I get an error when trying to enter the formula???

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: find next date based on cell value

    check the separators they should all be either , or ; not mixed
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Forum Contributor
    Join Date
    05-30-2014
    Posts
    112

    Re: find next date based on cell value

    Well, that made the formula work, but I am getting wrong results....it seems as though it is getting the date that is 2 after the previous date...

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: find next date based on cell value

    its missing the arguement for exact match
    you need to find the first time both are met so match()needs to be exact
    =INDEX(Sheet2!$B$2:$B$24960,MATCH(1,((Sheet2!$B$2:$B$24960>$L2)*(Sheet2!$C$2:$C$24960=$G2)),0))

  7. #7
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: find next date based on cell value

    Quote Originally Posted by martindwilson View Post
    its missing the arguement for exact match
    are you sure of that?
    Attached Files Attached Files

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: find next date based on cell value

    it whats supposed to be there just putting , actually assumes that though but is not correct syntax ,you should try to use what the help file shows or its not clear what has been done
    mind you i tried your formula again and it works as per op requirements i suspect op had put the index or match range starting from the wrong cell

+ 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. Code to Find a cell based on a date
    By tompee29 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-12-2014, 04:17 AM
  2. Replies: 0
    Last Post: 05-30-2013, 07:50 PM
  3. [SOLVED] find missing date on every group date list based on range and criteria
    By k1dr0ck in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2013, 01:26 AM
  4. Replies: 1
    Last Post: 08-13-2012, 11:18 AM
  5. Replies: 2
    Last Post: 03-31-2012, 01:08 AM

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