+ Reply to Thread
Results 1 to 9 of 9

Finding a value within a number/text

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-10-2008
    Location
    western hemisphere
    Posts
    128

    Finding a value within a number/text

    Hello,

    Is there any formula to search a value which lies within a number, for example if in A1, a value has been stored as: 051-01-12 or 051!01:12, and it is required to search a value like 05101 to 05112, the search function may hit the value stored as 051-01-12 or 051!01:12. Thanks.

    Flower R.

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    If these text values are in column A, can you use this in column B then search on these?

    =SUBSTITUTE(A1,"-","")
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Forum Contributor
    Join Date
    10-27-2006
    Location
    United Kingdom
    MS-Off Ver
    EXCEL 2003 (2007 at home)
    Posts
    517
    Old Chippys formula can of course be expanded as:

    =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"-","") ,"!",""),":","")
    to catch all the three possible deliminators you mentioned.

    Alternatively the EXCEL search allows "wild-cards" so you could search for 051?01?12 which would match with any deliminator.

    Mark.

  4. #4
    Forum Contributor
    Join Date
    10-27-2006
    Location
    United Kingdom
    MS-Off Ver
    EXCEL 2003 (2007 at home)
    Posts
    517

    Talking

    Your second post came through while I was writing mine, and made mine irrelevent!
    I've got to go now, but I expect old chippy can help you
    (he's usually pretty expert).

    Mark.

  5. #5
    Forum Contributor
    Join Date
    10-10-2008
    Location
    western hemisphere
    Posts
    128
    Thanks for reply but that does not serve the purpose. the formula as changed the value from 001-01-12 as a solid value 0010112 and if I try to find 00109 which lies within range it will not give anything. Actually 001-01-12 is to be taken as 00101 to 00112 so any number searched within 00101 to 00112 may be coming through.
    Flower R

  6. #6
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Well thanks for the compliment Mark@Work, you're not doing to badly yourself.

    Flower R can you post a sample of your sheet together with the expected result?

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    to extract begining and end of range from your two posted examples
    in b1
    =--LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"-","",1),"!",""),":","-"),(FIND("-",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"-","",1),"!",""),":","-")))-1)
    in c1
    =--(LEFT(SUBSTITUTE(SUBSTITUTE(A1,"!","-"),":","-"),FIND("-",SUBSTITUTE(SUBSTITUTE(A1,"!","-"),":","-"))-1)&MID(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"-","",1),"!",""),":","-"),(FIND("-",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"-","",1),"!",""),":","-")))+1,255))
    then in d1 dragged down
    =IF(AND($E$1>=B1,$E$1<=C1),"found","not found")
    with value to find in e1 (may be a problem if the last bit after ! or - is greater than 00-99)
    Last edited by martindwilson; 12-31-2008 at 11:30 AM.

  8. #8
    Forum Contributor
    Join Date
    10-27-2006
    Location
    United Kingdom
    MS-Off Ver
    EXCEL 2003 (2007 at home)
    Posts
    517
    Note that if the text is always three characters, then a delimiter, then 2 characters a delimiter then two characters, you could use the LEFT, MID and RIGHT instructions to rearrange the value.

    thus B1 becomes : =LEFT(A1,3)&MID(A1,5,2)
    and C1 becomes : =LEFT(B1,3)&RIGHT(B1,2)

    Mark.

  9. #9
    Forum Contributor
    Join Date
    10-27-2006
    Location
    United Kingdom
    MS-Off Ver
    EXCEL 2003 (2007 at home)
    Posts
    517

    One Last Thought

    Attached is a spread-sheet that attempts to provide a general solution that should be adaptable to a wide range of possible formats for your data.

    Mark
    Attached Files Attached Files

+ 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