+ Reply to Thread
Results 1 to 10 of 10

MATCH Function inconsistent in return value

Hybrid View

  1. #1
    Registered User
    Join Date
    07-12-2008
    Location
    london
    Posts
    4

    MATCH Function inconsistent in return value

    I am using Excel 2002 and trying to do something which should be simple with MATCH.

    I have an array of numbers ordered, starting at 0 and incrementing by 0.05 up to 20. I am then using the MATCH function to find the relative position of numbers 0,1,2,3,4 and 5. However, for number 0,1 and 2 the return value is one less than what it should be, for the numbers 3, 4 and 5 it is working as expected. By the way, the match_type I am using is the default 1.

    Also I have formatted everything to be numbers and tried various things already, so am beginning to wonder is this is a known issue. I really hope not.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Would help if you added the formula your referring to

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    07-12-2008
    Location
    london
    Posts
    4
    Sorry, I am a newbie and joined about 5 minutes ago.

    Okay so in in first A column I have my numbers 0, 0.05, 0.1, 0.15 upto 24.95, so lets call this range A1:A500 and call it myRange.

    Then in say C column, then I do MATCH 5 times...

    MATCH(0, myRange, 1) = 1 (correct)
    MATCH(1, myRange, 1) = 20 (wrong)
    MATCH(2, myRange, 1) = 40 (wrong)
    MATCH(3, myRange, 1) = 61 (correct)
    MATCH(4, myRange, 1) = 81 (correct)
    MATCH(5, myRange, 1) = 101 (correct)

    So real question is, why does it always get the second and third one listed above wrong?

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See example

    VBA Noob
    Attached Files Attached Files

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    works ok for me ,see attached put number in b1, could be a formatting problem?
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-12-2008
    Location
    london
    Posts
    4
    Thank you for your replies.

    I have to increment the numbers dynamically by 0.05 rather than have them fixed. When I do this, I see the error.

    I have uploaded an example.
    Attached Files Attached Files

  7. #7
    Forum Contributor snasui's Avatar
    Join Date
    07-15-2007
    Location
    Songkhla, Thailand
    MS-Off Ver
    2010, 365
    Posts
    167
    Because column A generate number with many digit.

    You can check by enter =Len(a1) in B1 > Copy down and see results.

    To solve this problem

    A2

    =ROUND(A1+0.05,2)

    Enter and copy down.

+ 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