+ Reply to Thread
Results 1 to 17 of 17

Index match if "date" is between 2 dates in 2 seperate columns.

  1. #1
    Registered User
    Join Date
    08-26-2015
    Location
    Melbourne
    MS-Off Ver
    2011
    Posts
    15

    Index match if "date" is between 2 dates in 2 seperate columns.

    I am trying to match a number in one spreadsheet against a number in another spreadsheet and extract the name which sits a few columns before said number.

    this issue is I only want to extract the name against this value if the date from the first spreadsheet falls in between two date (each in different columns) on the 2nd spread sheet.

    this is how far i've got but the formula just keeps returning False.

    =IF(AND(A1822>='Car Renter Transactions'!K:K,A1822<='Car Renter Transactions'!M:M),INDEX('Car Renter Transactions'!S:S,MATCH(H1822,'Car Renter Transactions'!W:W,0),FALSE))

    Is the formula the wrong way round? does it need to be =if(index? of does this if and statement not work because i am searching against the entire column where as each part of the formula kind of relies on the other part before it can process?

    Help?

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    Hello,

    post a data sample and explain in context. You don't have to post 1800 rows. Create a sample that resembles the structure you have.

    cheers, teylyn

  3. #3
    Forum Contributor
    Join Date
    10-19-2012
    Location
    Omaha, Nebraska USA
    MS-Off Ver
    Excel 2010
    Posts
    249

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    Hi Benjiboi_87,

    If what you are looking to do is return the value in Car Rental Transactions:Column S from the same row in Car Rental Transactions:Column W that matches the value in H1822 when the date in A1822 is greater than all the dates in Car Rental Transactions:Column K and is less than all the dates in Car Rental Transactions:Column M, than it works based on my check.

    Thanks,

    Dan

  4. #4
    Registered User
    Join Date
    08-26-2015
    Location
    Melbourne
    MS-Off Ver
    2011
    Posts
    15

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    Thanks Teylen,

    Please see attached.

    What Dan said below made sense and when i rand the data in test sheet i managed to get a result but it is only returning a result based on the same line item in the other sheet.. If this makes sense?

    Cheers
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-26-2015
    Location
    Melbourne
    MS-Off Ver
    2011
    Posts
    15

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    Thanks Tom,

    When running a test spreadsheet with same formula i was able to get it to work but only if the row number match on each spreadsheet. i.e. if running the formula from row A in spreadsheet 2 and the criteria for dates and Value were matching that required with the data in row 'A' of spreadsheet 1 then all is good. however if the data that met the criteria was in any other row on spreadsheet 1 then the result would not be returned.

    Cheers

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,997

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    It is hard to know if this formula yields the correct outcomes as no expected results are given in the file attached to post #4, however as best I can determine it works:
    Please Login or Register  to view this content.
    Let me know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  7. #7
    Registered User
    Join Date
    08-26-2015
    Location
    Melbourne
    MS-Off Ver
    2011
    Posts
    15

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    Thanks JeteMC,

    This works however it is still displaying the name based on rows. i.e. row 2 shows the name from data tab row 2, row 3 from row 3. so on and so fourth. It is not displaying the name based on the etag number match between the required dates?

    I feel we are getting closer though

  8. #8
    Registered User
    Join Date
    08-26-2015
    Location
    Melbourne
    MS-Off Ver
    2011
    Posts
    15

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    Thanks JeteMC,

    This works however it is still displaying the name based on rows. i.e. row 2 shows the name from data tab row 2, row 3 from row 3. so on and so fourth. It is not displaying the name based on the etag number match between the required dates?

    I feel we are getting closer though

  9. #9
    Registered User
    Join Date
    08-26-2015
    Location
    Melbourne
    MS-Off Ver
    2011
    Posts
    15

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    Just realised that previous formula still returns name even if date and tag number don't match, All its seems to do is return the name value?

  10. #10
    Registered User
    Join Date
    08-26-2015
    Location
    Melbourne
    MS-Off Ver
    2011
    Posts
    15

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    Just realised it was an array formula… Still not working though.. only one result was turned up with a name and it was the wrong name. and when i changed the tag number it had no effect on the result?

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,879

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    Try

    =IFERROR(INDEX(Data!I:I,MATCH(1,(Data!M:M=$H2)*($A2>=Data!A:A)*($A2<=Data!C:C),0)),"")

    enter with Ctrl+Shift+Enter

    As previously posted, it would help you added expected results to your posted file.

  12. #12
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,997

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    Sorry to have omitted that the formula was an array formula. I am not seeing the same behavior that is reported in post #10. I am attaching a copy of the file from post #4 so that we can both be sure that we are talking about the same results.
    Let me know if you have any questions.
    Attached Files Attached Files

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,879

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    Non-array version of my previous post:

    =IFERROR(INDEX(Data!$I:$I,MATCH(1,INDEX((Data!$M:$M=$H2)*($A2>=Data!$A:$A)*($A2<=Data!$C:$C),0),0)),"")

  14. #14
    Registered User
    Join Date
    08-26-2015
    Location
    Melbourne
    MS-Off Ver
    2011
    Posts
    15

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    John Topley you are a genius!

  15. #15
    Registered User
    Join Date
    08-26-2015
    Location
    Melbourne
    MS-Off Ver
    2011
    Posts
    15

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    Ok still having issues with the formula? have transferred it to the main spreadsheet as is and it is only working for the first cell.. from then on it shows blank even when everything matches. this applies to both formulas John Topley & JeteMC. you formulas both work in the test environment but only for the first cell in the live environment.

    Here is the formula from the live environment on a cell that is show blank when it shouldn't be.
    =ArrayFormula(IFERROR(INDEX('Car Renter Transactions'!S:S,MATCH(1,('Car Renter Transactions'!W:W=H584)*(A584>='Car Renter Transactions'!K:K)*(A584<='Car Renter Transactions'!M:M),0)),""))

    It only shows = array formula because the formula is in google sheets. Is there anything else I should check at my end. All cells are reflecting the right data type and all dates are in matching formats.

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,879

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    I have never used Google sheets: do ArrayFormula have to be entered with Ctrl+SHift+Enter as for Excel?

    Have you tried the non-array version:

    =IFERROR(INDEX(Data!$I:$I,MATCH(1,INDEX((Data!$M:$M=$H2)*($A2>=Data!$A:$A)*($A2<=Data!$C:$C),0),0)),"")

  17. #17
    Registered User
    Join Date
    08-26-2015
    Location
    Melbourne
    MS-Off Ver
    2011
    Posts
    15

    Re: Index match if "date" is between 2 dates in 2 seperate columns.

    Disregard figured it out thank you all

+ 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. Replies: 1
    Last Post: 03-23-2015, 06:19 PM
  2. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  3. Replies: 7
    Last Post: 04-11-2013, 12:46 AM
  4. Replies: 0
    Last Post: 01-09-2013, 06:52 PM
  5. Strings Variables in Range("A1").Formula = "=index/match" ?
    By nadnerb5 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-19-2012, 05:07 PM
  6. [SOLVED] Problem creating Line Chart from columns "date" and "money"
    By brosef in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 11-05-2012, 09:01 AM
  7. [SOLVED] Variable "sheet-name" and "range-name" wanted in INDEX/MATCH-function
    By Fiebuls in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-01-2012, 04:09 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