+ Reply to Thread
Results 1 to 4 of 4

Match function won't return correct row number

  1. #1
    Registered User
    Join Date
    11-23-2016
    Location
    Seattle, WA, USA
    MS-Off Ver
    2016
    Posts
    2

    Unhappy Match function won't return correct row number

    I have a weird problem I'm trying to auto populate to one sheet from another sheet and have run into a problem where it won't return the row number. I'm using a test function "=MATCH("durric",B:B,0)" on the sheet I'm trying to get the info from and looking directly at the matching string but the info that shows up is always #N/A. There are no duplicates and the column is even sorted(which doesn't help because I will need to index and match the info for the other sheet. I will also need to update this sheet and move around the data i'm searching through) if I take out 0 as the match type it will return the row# - 1 for this particular search and many others but some searches come up correct too. If I sort the sheet any other way all hell breaks loose. I've even tried pasting the data into a new sheet and the exact same thing happens. The data was copied over from a google sheet so I don't know if this is part of the problem either. I hope someone here will be able to point me in the right direction.

  2. #2
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,101

    Re: Match function won't return correct row number

    check if there's a leading or trailing space of the word 'durric'.

    That could be the reason why

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,418

    Re: Match function won't return correct row number

    If you use MATCH with zero as the final parameter, it will look for an exact match, and if there isn't one then it returns #N/A. Perhaps you have leading or trailing spaces in the values in column B, and so there is no exact match with "durric". You can try it like this:

    =MATCH("*durric*",B:B,0)

    where the asterisks are wildcard characters so you are looking for "durric" to be contained within any of the cells in column B.

    If you remove the zero from the MATCH function then the data in column B has to be sorted (and it doesn't seem as if it will always be sorted) and then it will carry out an inexact match on the value which is the nearest (lowest) value to the one sought - this can produce some unexpected results, especially with strings.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    11-23-2016
    Location
    Seattle, WA, USA
    MS-Off Ver
    2016
    Posts
    2

    Re: Match function won't return correct row number

    Oh my god such an easy fix, thank you both, now I feel like a dummy.

+ 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. search 2 variables, return the correct one beside each match
    By katri80 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-12-2016, 03:39 PM
  2. [SOLVED] Function to match text and return number in adjacent cell?
    By danoswalt in forum Excel General
    Replies: 6
    Last Post: 12-16-2014, 01:47 PM
  3. Match function to return column number for matching date errors
    By martinez77 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-07-2014, 10:39 AM
  4. Replies: 12
    Last Post: 03-29-2013, 03:02 PM
  5. [SOLVED] Formula with ROWS Function appears not to return correct number of rows
    By rzw30 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-22-2013, 07:05 AM
  6. Trying to return correct values using INDEX and MATCH
    By wayneknox01 in forum Excel General
    Replies: 2
    Last Post: 06-14-2012, 11:31 AM
  7. Using MATCH function does not return correct answer
    By LindaBabe54 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-31-2006, 09:58 AM

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