+ Reply to Thread
Results 1 to 8 of 8

Expanded FIND function (3 is found when the cell contains 1-5)

  1. #1
    Forum Contributor
    Join Date
    04-03-2009
    Location
    Anchorage, Alaska, USA
    MS-Off Ver
    Office 365
    Posts
    113

    Expanded FIND function (3 is found when the cell contains 1-5)

    Hi,

    Here's an interesting question. I want to find 3 be it a number or text, whatever. And I want to be successful in finding 3 because a cell contains "1-5" - not 1, 2, 3, 4 and 5 in separate cells, but "1-5" in once cell. I know there's all sorts of programming / computer-logic reasons why this difficult, but by now it should be solved - it should be a standard feature esp in Excel. Decades ago when computers were keeping millions of pieces of information, this should have been a feature, and I dont think it is. Or am I wrong?

    I'll illustrate :

    Capture.PNG

    Is 33229 part of this? Yes
    Is 93000 part of this? Yes, of course.

    You and I can find that practically instantly cause we know what we're looking at. Can the computer?

    I'm going to be working on this problem. Maybe what I'm trying to build is a smarter FIND function that also considers is-it-included-in-the-list. Any input you have is appreciated.

    Thank you.

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Expanded FIND function (3 is found when the cell contains 1-5)

    You don't say if those examples represent the values in two cells, one cell having 33214.33222 etc.
    but yes, using a search or find function and pointing it at a cell can return a positive if a 3 is found in a cell.
    something like this... =IF(ISNUMBER(SEARCH("3",A2)),"yes 3","no 3")
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Contributor
    Join Date
    04-03-2009
    Location
    Anchorage, Alaska, USA
    MS-Off Ver
    Office 365
    Posts
    113

    Re: Expanded FIND function (3 is found when the cell contains 1-5)

    Oh yeah - let me amend that snippet I took. Those are supposed to be commas, not dots/periods. So the picture in the OP reads as follow. And keep in mind the there's #s cut off :

    33214, 33222-33231, 33241, 33249, 33262-33264, 332
    0-93042, 93224-93299, 93279-93464, 93600-93622, G

    So in your reply, if the commas represent cells, then one cell would instead be 33214, not 33214.33222. Again, sorry for the poor quality of the snippet.

    So yes, I see your solution would find the number 3 if the cell contained a 3 (eg. 33214.33222 contains the number 3).

    Would it find the number 33229, which exists in the above snippet or in a cell that contains 33222-33231?
    Would it find the number 93000, which also exists in 93279-93464?
    Would it find 3 in a cell that contains 1-5?

    I dont think it will. But I do think you've supplied an important thought on a larger solution - gave me an idea.

    So I'm thinking a macro that identifies the dash (or minus-sign, whatever) - anyways it identifies the "-", then splits the cell on either side of the "-" making the left side the low number; right side the high number, then calculates for TRUE using operators <= and => and if both operators are TRUE then the search-term is within the range. In fact the macro goes through every cell in the list dash and no-dash. No dash means there's only one number in the cell and to calculate for TRUE as above cause either the #s going to equal the search-term or not (no need to program more calculations into the macro). The macro completes this for a range and spits out the result.

    Thank you for your reply.
    Last edited by akedm; 12-05-2019 at 04:52 PM.

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Expanded FIND function (3 is found when the cell contains 1-5)

    Could you post a sample workbook (instructions in the yellow bar at the top of the post) that contains some actual samples (not many needed) AND your expected solution to a couple so I (we) can get an idea of a formula to write. A macro may not be necessary or it may but I'm not sure I completely follow your description of your data and needs.

  5. #5
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,829

    Re: Expanded FIND function (3 is found when the cell contains 1-5)

    Quote Originally Posted by akedm View Post
    Would it find the number 93000, which also exists in 93279-93464?
    It does? How so?

  6. #6
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,829

    Re: Expanded FIND function (3 is found when the cell contains 1-5)

    If the number you want to see if it's within a range is in A1, and the range for which you are testing is in A2;
    so A1 could be 93789 and A2 = 91879-94897
    In cell C1, it could tell you "Yes" or "No" if it's within the range with this formula:

    =IF(AND(LEFT(A2,SEARCH("-",A2)-1)+0<=A1,RIGHT(A2,LEN(A2)-SEARCH("-",A2))+0>=A1+0),"Yes","No")

    (I had to put the "+0" in the formula because if I didn't, it didn't work - I don't know why, but it works with that in there).

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: Expanded FIND function (3 is found when the cell contains 1-5)

    Unless you do the +0, Excel sees the formula result as text. Adding 0 is one way to coerce Excel into seeing the text value as a number.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  8. #8
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,829

    Re: Expanded FIND function (3 is found when the cell contains 1-5)

    Ah, OK - thanks for the info!

+ 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. [SOLVED] Delete to last row based on found cell value using find function
    By terriertrip in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-01-2019, 04:40 PM
  2. Find and Replace - if not found, add function?
    By zombiejon in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-25-2017, 05:26 PM
  3. [SOLVED] FIND Function; looking for an array of strings and returning found string value
    By loloduane in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 05-05-2014, 04:11 AM
  4. Replies: 2
    Last Post: 10-12-2012, 11:38 PM
  5. vlookup function-for expanded payroll
    By cheggie1 in forum Excel General
    Replies: 4
    Last Post: 02-21-2007, 12:00 AM
  6. find the next empty cell: expanded
    By stew0720 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-23-2006, 01:59 PM
  7. Tab Key Expanded Cell Movement
    By DennisLeary in forum Excel General
    Replies: 2
    Last Post: 04-07-2006, 10:10 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