+ Reply to Thread
Results 1 to 18 of 18

Match Multiple Criteria & Find Oldest Date

Hybrid View

  1. #1
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Match Multiple Criteria & Find Oldest Date

    Hello,
    I am trying to return the oldest date within calls that match the SLA code and the region. I've used the formula listed below in the attached workbook, but it's not working. Can anyone please help me figure out a solution?

    Formula:
    =IF(AND($A$4:$A$7=Sheet2!$D$2:$D$497,$B$3="SLA4"),MIN(VLOOKUP(A5:A8,Sheet2!$D$455:$F$497,3,FALSE)),"")

    OPEN_CALL.xlsx

  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
    53,048

    Re: Match Multiple Criteria & Find Oldest Date

    Try this array formula...
    =MIN(IF(A7=Sheet2!$D$2:$D$497,Sheet2!F1:F496))
    ...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.

    Also, for the column B values...
    =COUNTIFS(Sheet2!$B$2:$B$497,$B$6,Sheet2!$D$2:$D$497,A7)
    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
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Match Multiple Criteria & Find Oldest Date

    Thank you so much for your help, but I'm getting 9/13/13, which is a SLA24. Table 1 is for SLA4 calls, so the oldest SLA4 call in Region 7988 is 10/10/13. Maybe my request wasn't clear. (sorry) The solution should meet both criteria, in that it should match the region and SLA4 detailed in column B. I have listed more detail below.

    Before it can return the oldest date, I need it to match two criteria in each table:
    Table 1
    Sheet2, column B = Sheet1, $B$6 = Filter only SLA4
    Sheet2, column D = Sheet1, $A7 = Filter only Region 7988 (total of 9 rows)
    ===> Oldest call = Column F (Contact Date) = Oldest Call = 10/10/13

    Table 2
    Sheet2, column B = Sheet1, $F$6 = Filter only SLA24
    Sheet2, column D = Sheet1, $E7 = Filter only Region 7988 (total of 77 rows)
    ===> Oldest call = Column F (Contact Date) = Oldest Call = 9/13/13

    Hopefully description that is more accurate. :D

  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
    53,048

    Re: Match Multiple Criteria & Find Oldest Date

    oops sorry, missed the SLA$ part. Use this array instead...
    =MIN(IF(A7&$B$6=Sheet2!$D$2:$D$497&Sheet2!$B$2:$B$497,Sheet2!$F$1:$F$496))
    change $B$6 to $F$6 for the 2nd table

  5. #5
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Match Multiple Criteria & Find Oldest Date

    I'm getting a #N/A error. I am using named ranges in my master report because it's fairly large. I changed your formula to reflect them per below:

    {=MIN(IF(SLA4_REGION1&$C$3=REGION1&SLA1,CONTACT_DATE1))}

    Would that make a difference?

    I am building this into a VBA Macro, so feel free to suggest one if there is a way to do that.

  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
    53,048

    Re: Match Multiple Criteria & Find Oldest Date

    T^hat would depend on what that range references?

    =MIN(IF(.....A7&$B$6....=Sheet2!$D$2:$D$497&Sheet2!$B$2:$B$497,Sheet2!$F$1:$F$496))
    .....A7&$B$6.... this references 1 cell each, with A7 pointing to the "area" and $B$6 being "fixed" to the column heading

    the formula is based on these 3 parts....
    IF("area" is found in the "area-range", find the min value for that "area")

    You didnt indicate what the range names you are using, contain, but...
    SLA4_REGION1 needs to be 1 cell referencing an area
    REGION1 needs to be the range of all Areas
    CONTACT_DATE1 needs to contain the range with the dates in them.

    Also, the ranges need to be the same length/size

  7. #7
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Match Multiple Criteria & Find Oldest Date

    Ooops, sorry!
    {=MIN(IF(SLA4_REGION1&$C$3=REGION1&SLA1,CONTACT_DATE1))}

    SLA4_REGION1 = 1st group of 4 regions in SLA4 TABLE
    Used to match necessary criteria from REGION1 column on data sheet.
    $C$3 = cell where "SLA4" text is found.
    Used to match necessary criteria SLA1 column on data sheet.
    CONTACT_DATE1 = Column in on data sheet where oldest call is found for noted region & SLA call type.

    $C$3 = SLA4
    AREA / REGION SLA4 OLDEST CALL
    7988-NY/NJ/CT REGION count
    7985-CAPITOL REGION count
    7980-NEW ENGLAND REGION count
    7976-MID-ATLANTIC REGION count

    Hopefully this makes sense.

  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
    53,048

    Re: Match Multiple Criteria & Find Oldest Date

    You need to remove the range name in the formula, and reference the specific cell. the formula is constructed to compare 2 cells with 2 cells - A1&B1 with J1&K1....
    did you try the formula I suggested in post # 4 without changing it 1sdt?
    =MIN(IF(A7&$B$6=Sheet2!$D$2:$D$497&Sheet2!$B$2:$B$497,Sheet2!$F$1:$F$496))
    ARRAY entered

  9. #9
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Match Multiple Criteria & Find Oldest Date

    YOU ROCK!!

    I finally got it to work!!

    Two things:
    1. When there are zero calls it's returning a 1/0/1900 date. I tried putting a ,""))} in the formula so it will just leave the cell blank, it still gives the same date.
    My formula is:{=MIN(IF($B$4&$C$3=REGION1&SLA1,CONTACT_DATE1,""))}
    2. I'm automating this for VBA. Since this is an array formula (requires CTRL+SHIFT+ENTER), is there anything special I should do, or will it be ok when I record the macro?

    I cannot thank you enough for your help!!!

  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
    53,048

    Re: Match Multiple Criteria & Find Oldest Date

    I know there is a better way than this, but I am having a brain flatule lol, so in the mean time, try this...

    =if(MIN(IF($B$4&$C$3=REGION1&SLA1,CONTACT_DATE1))=,'"",MIN(IF($B$4&$C$3=REGION1&SLA1,CONTACT_DATE1)))

    The 1/0/1900 is excels way of saying the answer is = 1 Jan 1900 (the start of the "excel calendar")

  11. #11
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Match Multiple Criteria & Find Oldest Date

    The exact above did not work, but I ended up with the formulas below and it worked!! Wooo Hooo!!

    =IF(MIN(IF($B4&$C$3=REGION1&SLA1,CONTACT_DATE1)),MIN(IF($B4&$C$3=REGION1&SLA1,CONTACT_DATE1)),"")


    and for VBA
    [SLA4_REG_7988].Select
    Selection.FormulaArray = _
    "=IF(MIN(IF(R4C2&R3C3=REGION1&SLA1,CONTACT_DATE1)),MIN(IF(R4C2&R3C3=REGION1&SLA1,CONTACT_DATE1)),"")"
    [SLA4_REG_7988] = [SLA4_REG_7988].Value

    Thank you so much!!

  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
    53,048

    Re: Match Multiple Criteria & Find Oldest Date

    Awesome, great job!!!! It's always sweeter when you figure your own way through something like this


    I just noticed I left out a ""....
    =if(MIN(IF($B$4&$C$3=REGION1&SLA1,CONTACT_DATE1))="","",MIN(IF($B$4&$C$3=REGION1&SLA1,CONTACT_DATE1)))

  13. #13
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Match Multiple Criteria & Find Oldest Date

    That one doesn't work. is it the = sign after the first formula group?

  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
    53,048

    Re: Match Multiple Criteria & Find Oldest Date

    Your original formula was...
    =MIN(IF($B$4&$C$3=REGION1&SLA1,CONTACT_DATE1))
    So all I did was to see if that returned a blank (""), which then became...
    =if( MIN(IF($B$4&$C$3=REGION1&SLA1,CONTACT_DATE1)) = "", "", MIN(IF($B$4&$C$3=REGION1&SLA1,CONTACT_DATE1))), so it should still be doing what it was before?

  15. #15
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Match Multiple Criteria & Find Oldest Date

    Hello!
    I need a little additional help if possible. I have been asked to add additional information to the same table utilizing the below formula. The formula Fdibbins provided below may need to be utilized to create the new formula, as there is a call number associated with the oldest date the formula provided.

    FORMULA HELP.jpg

  16. #16
    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
    53,048

    Re: Match Multiple Criteria & Find Oldest Date

    Hi again

    Sorry to do this, but please do not upload a picture of your file...rather, upload a sample of your workbook, showing what data you are working with, a few samples of your expected outcome is (manually entered is ok) and how you arrived at that. (exclude sensitive info). Pictures are pretty much impossible to edit, and no-one wants to re-type your data for you Also, not all members can upload picture files (Company firewalls and stuff)

  17. #17
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Match Multiple Criteria & Find Oldest Date

    OK... I've attached a sample copy of my workbook. The formula below works for the first cell, but it gives the same call number no matter what the oldest date is. So I'm not sure what the issue is.

    {=IF(IF(MIN(IF($A$3&$A$1=REGION1&SLA_1,CONTACT_DATE_TIME1)),MIN(IF($A$3&$A$1=REGION1&SLA_1,CONTACT_DATE_TIME1)),""),CALL_NUM1,"")}

    Hopefully you can help.

    OPEN_CALL1.xlsx

  18. #18
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Match Multiple Criteria & Find Oldest Date

    Never mind!! I figured it out.
    Used: =INDEX(CALL_DATA1,MATCH(MIN(IF($B5&"SLA4"=REGION1&SLA1,CONTACT_DATE_TIME1)),CONTACT_DATE_TIME1,0),COLUMN(CALL_NUM1)) and Ctrl+Shift+Enter.

+ 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. Find the oldest date
    By Rachel555 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-03-2013, 06:50 AM
  2. [SOLVED] Find oldest data, based on a criteria in another row
    By dutchdog in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-05-2012, 02:09 AM
  3. [SOLVED] Find Oldest Date for Criteria in different Column
    By mglassco in forum Excel General
    Replies: 12
    Last Post: 04-19-2012, 09:27 PM
  4. Find oldest date
    By ianma in forum Excel General
    Replies: 1
    Last Post: 09-01-2009, 10:02 AM
  5. Getting the oldest date with criteria
    By Sara_Chase in forum Excel General
    Replies: 5
    Last Post: 10-17-2006, 08:11 AM

Tags for this Thread

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