+ Reply to Thread
Results 1 to 3 of 3

Array Search

  1. #1
    Registered User
    Join Date
    01-22-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    5

    Array Search

    I am trying to search a column of data for string matches as part of a formula but I can't get the array search function to work properly.

    I put the data I want to search for in cell C4 and the column of data I want to search in B4:B9.

    So I am using this formula: =SEARCH(C4,B4:B9)
    I then press ctrl+shift+enter and the curly brackets appear at each end of the formula

    The problem is, the formula still only searches the first cell in the array, not the whole array. So if I had the following in column B:

    a
    b
    c
    d
    e
    f

    and I searched for a, the formula would return 1 but if I search for any of the other letters, it returns #value, which is a pain. If someone could point out what I am doing wrong I would be much obliged.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Array Search

    SEARCH isn't meant to be used with a range, it's for searching within a string.

    Not quite sure what result you are looking for but perhaps you should be looking at MATCH/INDEX.
    If posting code please use code tags, see here.

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Array Search

    If B is:
    abc
    ba
    bc
    ad

    SEARCH("a",B1:B4) will search "a" in B1,B2,B3,B4; gives array: {1,2,#value,1}
    Ctrl-shift-enter, and display first item (1) only. In fact, there are 4 items in array, if,instead of press CSE, try hit F9 to see items in array.
    Quang PT

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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