+ Reply to Thread
Results 1 to 7 of 7

Does INDEX and MATCH have to use arrays sorted in a particular order?

  1. #1
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Does INDEX and MATCH have to use arrays sorted in a particular order?

    I've attached a workbook which uses INDEX and MATCH on a list of trades that are sorted by date, newest date first. Each trade has two rows: The row which has the opening of the trade is always lower than the row which closes the trade.

    To match the openings to closings I'm using an INDEX/MATCH formula. Once I have matched the openings to closings I can do further calculations.

    The formula I'm using works for the first two rows of the trade history, but it fails on the third row and I can't figure out why. (The trade list must be sorted from newest to oldest, so the solution must take this into account)

    Any thoughts to solve this?

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Does INDEX and MATCH have to use arrays sorted in a particular order?

    How about, in O36 filled down
    =IF(OR(N36="close",N36="s/l",N36="t/p"),IF(INDEX(N37:$N$171,MATCH(D36,$D37:$D$171,0))="buy",F36-(INDEX(F37:$F$171,MATCH(D36,$D37:$D$171,0))),(INDEX(F37:$F$171,MATCH(D36,$D37:$D$171,0)))-F36),0)*$O$32

  3. #3
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Does INDEX and MATCH have to use arrays sorted in a particular order?

    Hi,
    I think you have a circular reference.

    In O38 your lookup value is D38, where it is part of the range it makes the search on...
    Maybe you need to adjust your range so it wont search the value on itself.....

    =IF(OR(N38="close",N38="s/l",N38="t/p"),IF(INDEX(N$38:$N$171,MATCH(D38,$D$38:$D$171,0))="buy",F38-(INDEX(F$38:$F$171,MATCH(D38,$D$38:$D$171,0))),(INDEX(F$38:$F$171,MATCH(D38,$D$38:$D$171,0)))-F38),0)*$O$32

  4. #4
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: Does INDEX and MATCH have to use arrays sorted in a particular order?

    Thanks. I tried both. Fluff, your formula works. Thanks!

    Belinda when I use your formula the calc returns 0. Not sure why. But Fluff's solution doesn't cause a circular error message so I'll give it a go.

    I appreciate your help!

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

    Re: Does INDEX and MATCH have to use arrays sorted in a particular order?

    Did you replace the original workbook? Those formulas don't match the current attachment (cf. cols D & N)
    "...Each trade has two rows..." Is column D the trade ID?
    Last edited by protonLeah; 06-20-2020 at 04:46 PM.
    Ben Van Johnson

  6. #6
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105
    Hi,
    I didnt provide you a solurion , just xopied your formula to mirror the error...

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Does INDEX and MATCH have to use arrays sorted in a particular order?

    Fluff, your formula works. Thanks!
    You're welcome & thanks for the feedback

+ 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] Querying Large Series of Arrays And Displaying Unique Values in Arrays [Hard Index Match?]
    By larryg003 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-28-2020, 04:52 PM
  2. [SOLVED] Match-Index in stead of Index-Match lookup Array among Arrays
    By Numnum in forum Excel General
    Replies: 2
    Last Post: 10-15-2015, 02:08 PM
  3. [SOLVED] Index match max sorted hight to low
    By Blake 7 in forum Excel General
    Replies: 4
    Last Post: 07-30-2014, 07:14 AM
  4. [SOLVED] Creating a sorted list, using INDEX, MATCH, LARGE, COUNTIF
    By amnesiac77 in forum Excel General
    Replies: 7
    Last Post: 07-25-2014, 10:56 AM
  5. [SOLVED] HELP! Dynamic data sorted lists Index & Match?!?
    By connmtc in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-27-2014, 11:52 AM
  6. [SOLVED] Index & Match returning incorrect value. Arrays fixed and exact match used.
    By SDes in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-07-2012, 08:29 PM
  7. index,match,match on un-sorted data
    By Brisbane Rob in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-24-2005, 05:04 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