+ Reply to Thread
Results 1 to 15 of 15

Seaching for last date that meets requirements

  1. #1
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Henderson, KY
    MS-Off Ver
    Excel 2007
    Posts
    152

    Seaching for last date that meets requirements

    I am hoping to find a way to search for the entry in sheet "Jan" that has the newest date in column B, that also has a 101, 103, or 121 in column E,
    and is sorted for either a 1,2, or 3 in column G.

    I have attached an example workbook.
    The data is in sheet "Jan" and the results in sheet "Spot PMs"

    I filled in the expected results in "Spot PMs" B3 and C3

    I will end up with a sheet for each month, with 3000 to 4000 rows of entries each.
    With 300 to 400 different "Die Numbers" in column B.

    Thanks for any help you can give.

    Mike
    Attached Files Attached Files
    Last edited by Befuddled; 09-04-2015 at 01:35 AM. Reason: Solved

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,944

    Re: Seaching for last date that meets requirements

    This ARRAY formula will give you the 1st 1 you wanted...
    =LARGE(IF((Jan!$D$2:$D$28=Jan!$O3)*(Jan!$G$2:$G$28=1)*(Jan!$E$2:$E$28={101,103,121}),Jan!$B$2:$B$28),1)


    Im not sure about the 2nd 1, but maybe just change the bolded 1 to 2 or 3?...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Henderson, KY
    MS-Off Ver
    Excel 2007
    Posts
    152

    Re: Seaching for last date that meets requirements

    That works great.
    I added the formula in "Spot PMs" D3 to look for a 3 in "Jan" column G.
    How would I modify the Large part of the formulas in B3 and C3 to also look to see if the date in D3 is higher?

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,944

    Re: Seaching for last date that meets requirements

    I modified the formula to look at the date...
    =LARGE(IF((TEXT(Jan!$B$2:$B$28,"mmm")=Jan!$P$1)*(Jan!$D$2:$D$28=Jan!$O3)*(Jan!$G$2:$G$28=1)*(Jan!$E$2:$E$28={101,103,121}),Jan!$B$2:$B$28),1)

    Still CSE
    Last edited by FDibbins; 09-04-2015 at 12:41 AM.

  5. #5
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Henderson, KY
    MS-Off Ver
    Excel 2007
    Posts
    152

    Re: Seaching for last date that meets requirements

    I tried adding the items in BOLD, but it gives a #VALUE! error
    =LARGE([B]([B]IF((Jan!$D$2:$D$28=Jan!$O3)*(Jan!$G$2:$G$28=1)*(Jan!$E$2:$E$28={101,103,121}),D3),Jan!$B$2:$B$28),1)
    Last edited by Befuddled; 09-04-2015 at 12:42 AM.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,944

    Re: Seaching for last date that meets requirements

    Not really sure what you are trying to do there? The modified formula I gave you will test for "Jan" as well as for all the other stuff, just replace my 1st formula with the 2nd formula

  7. #7
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Henderson, KY
    MS-Off Ver
    Excel 2007
    Posts
    152

    Re: Seaching for last date that meets requirements

    I'm not sure why it is not working for me.
    I get a #NUM! error when I copy and paste your formula into "Spot PMs" B3
    What is the formula looking for in Jan!$P$1 and Jan!$O3 ?

    Sorry about the jumble in previous post, I was just trying to make the changes I made show up in BOLD print

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,944

    Re: Seaching for last date that meets requirements

    My apologies, I had copied your table from sheet2 over to sheet1 so I could more easily see what I was working with when I constructed the formula. I then copied it back to sheet2, but neglected to adjust some of teh references It shouild have been this,....
    =LARGE(IF((TEXT(Jan!$B$2:$B$28,"mmm")=$B$1)*(Jan!$D$2:$D$28=$A3)*(Jan!$G$2:$G$28=1)*(Jan!$E$2:$E$28={101,103,121}),Jan!$B$2:$B$28),1)

  9. #9
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Henderson, KY
    MS-Off Ver
    Excel 2007
    Posts
    152

    Re: Seaching for last date that meets requirements

    Is there a way to combine the formulas(in the new attached workbook) in "Spot PMs" B3 and E3 in B3 (and C3 and F3) so I do not have to have 2 more columns of formulas?
    Attached Files Attached Files

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,944

    Re: Seaching for last date that meets requirements

    Perhaps this?
    =MAX(LARGE(IF((TEXT(Jan!$B$2:$B$28,"mmm")=$B$1)*(Jan!$D$2:$D$28=$A3)*(Jan!$G$2:$G$28=1)*(Jan!$E$2:$E$28={101,103,121}),Jan!$B$2:$B$28),1),LARGE(IF((TEXT(Jan!$B$2:$B$28,"mmm")=$B$1)*(Jan!$D$2:$D$28=$A3)*(Jan!$G$2:$G$28=3)*(Jan!$E$2:$E$28={101,103,121}),Jan!$B$2:$B$28),1))
    Still CSE

    This is just testing to see which of those 2 formulas returns the highest value (date)...
    =MAX(
    LARGE(IF((TEXT(Jan!$B$2:$B$28,"mmm")=$B$1)*(Jan!$D$2:$D$28=$A3)*(Jan!$G$2:$G$28=1)*(Jan!$E$2:$E$28={101,103,121}),Jan!$B$2:$B$28),1),
    LARGE(IF((TEXT(Jan!$B$2:$B$28,"mmm")=$B$1)*(Jan!$D$2:$D$28=$A3)*(Jan!$G$2:$G$28=3)*(Jan!$E$2:$E$28={101,103,121}),Jan!$B$2:$B$28),1))

  11. #11
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Henderson, KY
    MS-Off Ver
    Excel 2007
    Posts
    152

    Re: Seaching for last date that meets requirements

    That is awesome, and works perfect.
    Thanks for all your effort.

    I hate to monopolize your time, but is there a way to have the formula look at a named range instead of {101,103,121} ?

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,944

    Re: Seaching for last date that meets requirements

    As far as I know, you cannot use range names for this kind of array

  13. #13
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Henderson, KY
    MS-Off Ver
    Excel 2007
    Posts
    152

    Re: Seaching for last date that meets requirements

    OK.
    Again, thanks for all your help, I have been beating my head on this for a week, my searches on this forum had not been very fruitful.

    Mike

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,944

    Re: Seaching for last date that meets requirements

    Yes, the search facility on this forum (and others that I frequent) are often not of the best

    It was fun helping you, thanks for the feedback

  15. #15
    Forum Contributor
    Join Date
    09-22-2009
    Location
    Henderson, KY
    MS-Off Ver
    Excel 2007
    Posts
    152

    Re: Seaching for last date that meets requirements

    Hate to bother you again, but if the formula does not find both a 1 and a 3, it returns a #NUM! error.
    If you delete the "3" in G18, it throws the errors

+ 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] Macro to copy data from one cell to another if adjacent cell meets certain requirements?
    By rrokicki in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-08-2016, 07:41 AM
  2. Link Partial Data To Cell If Data Meets Requirements
    By swordswinger710 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-20-2012, 10:47 AM
  3. Copy rows of data if date in cells meets certain date criteria
    By angrycartoon12 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-02-2010, 05:57 AM
  4. Seaching a text list using IF
    By BobTheRocker in forum Excel General
    Replies: 3
    Last Post: 11-24-2010, 08:01 AM
  5. Linking Partial Data From One Cell If Data In Another Cell Meets Requirements
    By swordswinger710 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 01-20-2009, 12:09 PM
  6. Seaching for a String within a cell
    By mwehby18 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-10-2008, 06:07 PM
  7. [SOLVED] Excel formula that sums if meets two requirements.
    By JDub in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-05-2005, 03:55 PM
  8. Seaching across the top
    By Ben H in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-16-2005, 12:45 PM

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