+ Reply to Thread
Results 1 to 11 of 11

Search cell value in a range

  1. #1
    Registered User
    Join Date
    02-03-2018
    Location
    Manchester, UK
    MS-Off Ver
    2013
    Posts
    58

    Search cell value in a range

    Hi all,

    I need a formula to return a True / False value from searching a cell value in a range of data. As an example:

    Cell Ref: 12345

    Data Range: A1:Z500

    Can a formula return a 'True' value if that number - 12345 - is located somewhere in the data range?

    Thank you,

    Lee.

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

    Re: Search cell value in a range

    Lee

    Try this.

    =COUNTIF(A1:Z500, 12345)>0
    If posting code please use code tags, see here.

  3. #3
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 for Mac OSX, 365 for windows, Windows 10 Insider
    Posts
    6,515

    Re: Search cell value in a range

    =COUNTIF(A1:Z500,12345)>0

    This will look for numbers
    If TEXT then "ABC"
    Wayne

    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    7,660

    Re: Search cell value in a range

    Try:

    =COUNTIF(A1:Z500,12345)>0

  5. #5
    Registered User
    Join Date
    02-03-2018
    Location
    Manchester, UK
    MS-Off Ver
    2013
    Posts
    58

    Re: Search cell value in a range

    Hi Norie,

    Thanks. I think I need to clarify further.

    The cell values are unique; they could be 86867, or 12345 or something else. Is it possible to search this number in a string text in the data range? Is this possible?

    Thanks again,

    Lee.

  6. #6
    Forum Contributor
    Join Date
    02-09-2021
    Location
    New York
    MS-Off Ver
    Office 2019
    Posts
    140

    Re: Search cell value in a range

    Hi LMills77,

    You can try sumproduct:
    HTML Code: 
    =SUMPRODUCT(--(A1:Z500 = 86867))>0
    Hope this helps
    Last edited by D13L; 05-04-2021 at 05:58 AM.

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

    Re: Search cell value in a range

    If you want to do a partial searching:

    for value
    =OR(ISNUMBER(SEARCH(12345,A1:Z500)))

    or for text

    =OR(ISNUMBER(SEARCH("12345",A1:Z500)))

  8. #8
    Registered User
    Join Date
    02-03-2018
    Location
    Manchester, UK
    MS-Off Ver
    2013
    Posts
    58

    Re: Search cell value in a range

    Hi DL,

    Yeah, it's kind of worked but it's only picked up certain results. I have other cell values it hasn't picked up. Trying to figure out why it hasn't?

    I've put the formula in as:

    =SUMPRODUCT(--EXACT(A1:Z500, cell reference))>0

    Thanks again,

    Lee.

  9. #9
    Forum Contributor
    Join Date
    02-09-2021
    Location
    New York
    MS-Off Ver
    Office 2019
    Posts
    140

    Re: Search cell value in a range

    Hi Lmills77,

    if you're dragging this formula, you need to lock the range.

    PHP Code: 
    =SUMPRODUCT(--EXACT($A$1:$Z$500cell reference))>
    If you're not dragging it down please try:

    PHP Code: 
    =SUMPRODUCT(--($A$1:$Z$500 cell reference))>

    Lastly if your search is a partial text 1234 and between text EX: AB1234CD
    Then try

    =MATCH("*" & 1234 & "*",$A$1:$Z$500,) > 0


    Hope any of these helps
    Last edited by D13L; 05-04-2021 at 06:26 AM.

  10. #10
    Forum Contributor
    Join Date
    10-14-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2019
    Posts
    292

    Re: Search cell value in a range

    Quote Originally Posted by bebo021999 View Post
    If you want to do a partial searching:

    for value
    =OR(ISNUMBER(SEARCH(12345,A1:Z500)))

    or for text

    =OR(ISNUMBER(SEARCH("12345",A1:Z500)))
    In attachment you find the combination for text and value
    Attached Files Attached Files
    Kind regards,
    Piet Bom

  11. #11
    Registered User
    Join Date
    02-03-2018
    Location
    Manchester, UK
    MS-Off Ver
    2013
    Posts
    58

    Re: Search cell value in a range

    Thanks very much DL. This did exactly what I was looking for.

    Thanks again,

    Lee.

+ 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. Replies: 8
    Last Post: 03-24-2021, 08:36 AM
  2. [SOLVED] Search Range, find criteria, offset, copy and paste to blank cell in new specified range
    By fellodan in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-14-2019, 01:42 PM
  3. Replies: 4
    Last Post: 10-23-2018, 11:30 PM
  4. Creating search box in cell - Currently using Macro 'Range to search' *HELP*
    By jacko058 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2014, 05:24 AM
  5. Replies: 4
    Last Post: 09-24-2013, 08:57 AM
  6. Replies: 4
    Last Post: 05-12-2011, 02:25 PM
  7. [SOLVED] Search if a cell range contains a particular value
    By PCLIVE in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-01-2005, 01:05 PM

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