+ Reply to Thread
Results 1 to 8 of 8

Trying to create an if index match formula of some sort

  1. #1
    Registered User
    Join Date
    09-30-2014
    Location
    Massachusetts
    MS-Off Ver
    2010
    Posts
    10

    Trying to create an if index match formula of some sort

    I'm struggling with a formula and would love some help. I have the following spreadsheet:
    Screenshot.jpg

    Essentially, I have a column of dates in column H that is each associated with an ID# in column G. The same ID might have multiple dates. The same ID is in column A as well. I want a formula that will allow me to look in A for the ID in G, and for the dates associated in column C, tell me whether any of them are within two weeks before or two weeks after the date in column H.

    I can't just do a lookup, because the lookup will stop when it finds the first instance of the ID#, and the relevant date might be the third or fourth. I've tried doing an index, but I'm not sure what to index, since I'm actually looking for whether the date is within the two week period (and that two week period isn't spelled out to index). I'm thinking there's some kind of if clause I can add in, but it's eluding me. Please help!

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,288

    Re: Trying to create an if index match formula of some sort

    Post a short workbook with your data structure, and show what you want as a result of the formula. Highlight the cells that should be used in the formula, with notes...
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    09-30-2014
    Location
    Massachusetts
    MS-Off Ver
    2010
    Posts
    10

    Re: Trying to create an if index match formula of some sort

    I've attached an xls with some sample data, only the relevant columns, and the result I'm trying to achieve (F2).

    Thanks!
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,288

    Re: Trying to create an if index match formula of some sort

    Here is my effort - I also differentiated between those entries that had no matching entries and those that were or weren't within 14 days.

    RAF_lifecycle__referred_HH (sample).xlsx

  5. #5
    Registered User
    Join Date
    09-30-2014
    Location
    Massachusetts
    MS-Off Ver
    2010
    Posts
    10

    Re: Trying to create an if index match formula of some sort

    Thanks so much! It's mostly working but not quite. In the sample xls that you posted, it seems to come out correctly, but when I use the formula in my complete xls (with 45k rows), some of the results are giving me Y when there isn't actually an order date 0-14 days after. My xls is formatted the same way, with the columns in the same places, so I didn't need to adjust it except to adjust the row number for the last row of data. The only difference is the quantity of data. Any ideas?

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,288

    Re: Trying to create an if index match formula of some sort

    When you edit the formula, you need to use Ctrl-Shift-Enter instead of just Enter, because it is an array-formula.

  7. #7
    Registered User
    Join Date
    09-30-2014
    Location
    Massachusetts
    MS-Off Ver
    2010
    Posts
    10

    Re: Trying to create an if index match formula of some sort

    Aha. So that does work. However, when I try to copy it down, I can't copy it with a cntl-shift-enter (or can I?).

    A coworker is actually restructuring the data in our reporting system to make this much easier, so I don't actually need the formula above anymore. But I'm curious about this formula because I don't fully understand it. I understand the concepts of index and match, but what does the MIN portion of the formula do? I'd love to be able to replicate this formula (or something like it) in the future if need be, so would love to understand it better.

    Thank you so much for all your help!

  8. #8
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,288

    Re: Trying to create an if index match formula of some sort

    Initial entry of the formula requires Ctrl-Shift-Enter, but after that you can copy/paste the formula like any other. There are some array formulas that require entry into multiple cells, but this is not one of them.

    The MIN is used to find the date closest to the date of interest, which was your original problem statement. The formula finds all the matching dates and see which of those dates is the closest, to determine if the result should be Y or N.

+ 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. Formula to Index, Match, Rank, and Sort a Dynamic Range of Values
    By AustinLe in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-14-2014, 03:49 AM
  2. Sort index match if condition
    By Ravenousdead in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-09-2014, 12:24 PM
  3. A- Z Sort breaking with Index Match
    By Vaslo in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-15-2013, 05:22 PM
  4. Replies: 3
    Last Post: 05-02-2013, 01:31 AM
  5. index match sort problem
    By score in forum Excel General
    Replies: 2
    Last Post: 08-30-2012, 09:38 PM

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