+ Reply to Thread
Results 1 to 9 of 9

Finding text within a cell

  1. #1
    Registered User
    Join Date
    05-29-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    63

    Finding text within a cell

    Hello,

    I've got the following formula:

    =IF(LEFT(G2,1)="7","Mobile","")

    Which basically tells me if the number in G2 starts with a 7, it must be a mobile number.

    BUT I need to insert another criteria which is, if cell I2 (description column) includes the words "personal" or "PNS" then its a personal number.

    I cant seem to get the formula to work with a FIND insert, could anyone help please?

    Many many thanks

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Finding text within a cell

    Is it something like this you are lokking for?
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    EDIT: =SEARCH() is not case sensitive.
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

  3. #3
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Finding text within a cell

    =IF(LEFT(G2,1)="7","Mobile","")&IF(ISERROR(FIND("personal",I2)),IF(ISERROR(FIND("PNS",I2)),""," Personal")," Personal")
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  4. #4
    Registered User
    Join Date
    05-29-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    63

    Re: Finding text within a cell

    Hello,
    Thanks for your responses but I cant quite get this to work - the formula doesnt error, but just returns a blank. I've got an example of my spreadsheet below

    Column G Column H Column J Column K
    7777777777 Personal Number
    7777777778


    In the first row i'd want column K to repond as "Personal" as its a number that starts with 7 and has the word "personal" or "pns" in the description(column J). In the second row i'd want column K to repond as "Mobile" as its a number that starts with 7 and doesnt have the work "personal" or "pns" in the description.

    Does this make sense?

  5. #5
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Finding text within a cell

    In that case..

    =IF(ISERROR(FIND("Personal",H2)),IF(ISERROR(FIND("PNS",H2)),IF(LEFT(G2,1)="7","Mobile",""),"Personal"),"Personal")

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Finding text within a cell

    this was wrong
    Last edited by martindwilson; 08-03-2012 at 08:04 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  7. #7
    Registered User
    Join Date
    05-29-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    63

    Re: Finding text within a cell

    Yes, that works, thank you so much.

    The only issue i'm contending with now is case sensitive. The formula works for cells with"Personal" but not with "personal" - is there an easy fix?

  8. #8
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Finding text within a cell

    Maybe..

    =IF(ISERROR(FIND("Personal",PROPER(H2))),IF(ISERROR(FIND("PNS",H2)),IF(LEFT(G2,1)="7","Mobile",""),"Personal "),"Personal")

    or even better

    =IF(ISERROR(FIND("PERSONAL",UPPER(H2))),IF(ISERROR(FIND("PNS",UPPER(H2))),IF(LEFT(G2,1)="7","Mobile",""),"Personal "),"Personal")

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Finding text within a cell

    =IF(LEFT(G1)="7",IF(ISNUMBER(LOOKUP(2,1/SEARCH({"personal","pns"},H1))),"personal","mobile"),"")
    btw search is not case sensitive you can use that instead of find
    Last edited by martindwilson; 08-03-2012 at 08:08 AM.

+ 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