+ Reply to Thread
Results 1 to 2 of 2

Use Match to locate a item in an array

  1. #1
    Registered User
    Join Date
    12-11-2003
    Location
    Beijing
    Posts
    2

    Use Match to locate a item in an array

    Hi:

    I wrote a piece of code in which i used a two dimension array. I wanted to locate a certain value in this array. Since i know one dimension of where the value is stored i want to fix this dimension and simply look at the other dimension.

    The following is the code but it is no good.
    Please Login or Register  to view this content.


    Could anybody help me out?

    Thanks
    Last edited by VBA Noob; 10-15-2007 at 06:40 PM.
    Wang Chris DP

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Chrisrita,

    The MATCH worksheet function won't work in his case because your array is not a Range Object. You will need to use a different method.

    Syntax
    MATCH(lookup_value,lookup_array,match_type)

    Lookup_value is the value you use to find the value you want in a table.

    Lookup_value is the value you want to match in lookup_array. For example, when you look up someone's number in a telephone book, you are using the person's name as the lookup value, but the telephone number is the value you want.


    Lookup_value can be a value (number, text, or logical value) or a cell reference to a number, text, or logical value.

    Lookup_array is a contiguous range of cells containing possible lookup values. Lookup_array can be an array or an array reference.

    Match_type is the number -1, 0, or 1. Match_type specifies how Microsoft Excel matches lookup_value with values in lookup_array.

    If match_type is 1, MATCH finds the largest value that is less than or equal to lookup_value. Lookup_array must be placed in ascending order: ...-2, -1, 0, 1, 2, ..., A-Z, FALSE, TRUE.


    If match_type is 0, MATCH finds the first value that is exactly equal to lookup_value. Lookup_array can be in any order.


    If match_type is -1, MATCH finds the smallest value that is greater than or equal to lookup_value. Lookup_array must be placed in descending order: TRUE, FALSE, Z-A,...2, 1, 0, -1, -2,..., and so on.


    If match_type is omitted, it is assumed to be 1.

    Sincerely,
    Leith Ross

+ 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