+ Reply to Thread
Results 1 to 12 of 12

Grab data if date conditions are met...

  1. #1
    Registered User
    Join Date
    06-17-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    25

    Grab data if date conditions are met...

    I am looking at cycles starting from K1 all the way to B1.
    For each date in column A I want to find the data point corresponding to the right cycle for "date + 10 days" (which I have in column M).
    Column P have the results I need. For example I get P2 by looking at M2 and STARTING AT K1, I want to find the date > M2 AND closest to M2. So my loop will start at K1, then J1 then I1 and so on until it fulfills the condition and then will return the data underneath.
    I would like my macro to take into account column M so it does not appear on the sheet.

    Thanks!!!!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Grab data if date conditions are met...

    Try next UDF
    P2=Treat(A2,$B$1:$K$1,B2:K2)
    Copy and paste down

    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

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

    Re: Grab data if date conditions are met...

    You can also use a formula:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    06-17-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Grab data if date conditions are met...

    thanks guys!

  5. #5
    Registered User
    Join Date
    06-17-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Grab data if date conditions are met...

    Hey Ben, do you know how to do "greater than OR EQUAL" with the match function? (-1 does greater than).

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Grab data if date conditions are met...

    Yes, the data must arranged in order first though.

  7. #7
    Registered User
    Join Date
    06-17-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Grab data if date conditions are met...

    PCI, it works great but I was trying to get a code without the use of a function and also with dynamic ranges as my data and ranges will change everyday as I add more data. Sorry for not detailing more at first.

  8. #8
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Grab data if date conditions are met...

    Take care with the MATCH
    "The values in the lookup_array argument must be placed in descending order" : it seems OK here ...!
    What do you mean Dynamic range in your example ?
    You want a macro instead of a Function ?
    Last edited by PCI; 08-04-2016 at 04:49 AM.

  9. #9
    Registered User
    Join Date
    06-17-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Grab data if date conditions are met...

    PCI, by dynamic range I mean that there will be more data added and therefore the range b1:k1 will grow, as well as the full array of data. And a macro that prints the results in a certain column would be better than a function. thanks!!

  10. #10
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Grab data if date conditions are met...

    If you want to put the result just after the last column see next code
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    06-17-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Grab data if date conditions are met...

    Thanks PCI its great! why do you set RRg as range and not date?

  12. #12
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Grab data if date conditions are met...

    It is a range with a date value, this range is in fact a cell part of the used range inside the first column

+ 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] Grab Date on condition
    By Parth007 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-02-2016, 05:17 AM
  2. Grab data from two sheets on two conditions
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-12-2016, 07:40 PM
  3. Replies: 6
    Last Post: 04-26-2013, 03:45 PM
  4. Replies: 9
    Last Post: 12-27-2011, 12:52 AM
  5. [SOLVED]True, False conditions and numbers to grab
    By S3b in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-20-2011, 03:18 PM
  6. Grab cell value meeting few conditions.
    By Henrique in forum Excel General
    Replies: 2
    Last Post: 02-23-2010, 12:10 PM
  7. [SOLVED] grab max date from list
    By jenn in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-20-2005, 02:06 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