+ Reply to Thread
Results 1 to 4 of 4

Match formula does not work when data is sorted

  1. #1
    Registered User
    Join Date
    12-02-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 2003
    Posts
    21

    Match formula does not work when data is sorted

    I am using the match formula to identify get a date off of an input sheet.

    +INDEX('INPUT SHEET'!B:B,MATCH(A34,'INPUT SHEET'!I:I,0))

    The formula itself works perfectly and I get the right results. Because not every line returns a value or some values may be different, I need to sort the results.

    My problem is when I sort the results, the match reference cell doesn't adjust to the new sorted position. In other words, if A34 has the match data prior to the sort, but after the sort, the match data is now on A5, my formula doesn't change from +INDEX('INPUT SHEET'!B:B,MATCH(A34,'INPUT SHEET'!I:I,0)) to +INDEX('INPUT SHEET'!B:B,MATCH(A5,'INPUT SHEET'!I:I,0)).

    As a result of this, I now get inaccurate results. Does anyone have a suggestion on how to fix this?

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Match formula does not work when data is sorted

    Hi,

    Please upload your workbook so that we can see the request in context.

    Regards
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191

    Re: Match formula does not work when data is sorted

    There are four ways around this that I can see:
    1. (Recommended) When you sort, simply include the column that has this formula. When you sort A, the formulas will be sorted as well.
    2. In a cell preferably in a blank row just above your other formulas, (could be in a hidden row if you want), keep a master of the formula. When you're done sorting, highlight this cell down through the end of your formulas and hit Ctrl+D. This will readjust them all.
    3. (Not really recommended, but one of two ways to avoid any additional steps every time) Change your formula to =Index('INPUT SHEET'!B:B,MATCH(INDIRECT("A"&ROW()),'INPUT SHEET'!I:I,0)). This is not recommended simply because Indirect is a volatile function and, as such, will make your sheet recalculate over any change and thus slow it down.
    4. If you're into setup work obviating the need for additional work later, you can insert two columns after A, perhaps you can work in the attached spreadsheet that I made a while ago for another issue. It takes a list in A and autosorts it in C. Naturally, your formulas would then have to refer to C.
    Attached Files Attached Files
    Life is about perseverance. Remember: today's mighty oak tree is just yesterday's nut that held its ground.

    If you like a post, please rate it with the scales icon (top right).
    If you feel really indebted, please consider a donation to charity, such as Feed the Children or Habitat for Humanity.

  4. #4
    Registered User
    Join Date
    12-02-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: Match formula does not work when data is sorted

    I do include the formula cells in the sort. I'm trying to load an example, but I'm having trouble.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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