+ Reply to Thread
Results 1 to 19 of 19

converting text to a number

  1. #1
    Registered User
    Join Date
    05-06-2013
    Location
    toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    75

    keywoard matching

    Hello all, I've ran into trouble in terms of coding for my excel spreadsheet.

    D2: 259 1/2IN 40D ISOPRENE
    D3: 15/16 IR 40D (176 3/4)
    D4: 153 3/4IN 40D NEOPRENE

    If I want to search for the inch in each text and only return the size(i.e 259 1/2 for D2, 176 3/4 for D3. 153 3/4, for D4) respectively, how would I go about doing this.

    I'd really appreciate all your help and hope you are having a wonderful day.

  2. #2
    Registered User
    Join Date
    05-06-2013
    Location
    toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    75

    Cool keyword matching in a cell(compliated)

    Hi, thank god for all you intellectuals to possibly help me!


    Book1.xlsx

    As you can see from the attached, I have a list of products in Column A and in Column B

    I just want to size to be returned(i.e 252 1/2 for B2, 176 3/4 for B3, 192 1/2 for B4, 153 3/4 for B6)

    Notice that the digits of the size can be different(i.e A24 only has 60 3/4). The point is, size is not strictly restricted to 2 or 3 digits.

    For me this looks complicated to put all into one function so I thought there could be a way to use IF&OR to possibly tackle this problem.

    Any help would be greatly appreciated.

    Thank you and have a great day!

  3. #3
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: keywoard matching

    For all of the entries, is the first letter "I"?
    Please click the * icon below if I have helped.

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: keyword matching in a cell(compliated)

    hk4kim,

    Welcome to the forum!
    Using your provided example file, use this formula in cell B2 and copy down:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  5. #5
    Registered User
    Join Date
    05-06-2013
    Location
    toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: keywoard matching

    Yes it is.

  6. #6
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: keywoard matching

    This should do it:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-06-2013
    Location
    toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: keywoard matching

    Do you mind explainig what this does and what -1 is?

  8. #8
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: keywoard matching

    The LEFT function has two portions:
    1 - The cell you are looking in
    2 - The # of characters you want to have returned.

    The FIND function returns the location of a character in a cell. It has three portions:
    1 - The Character you want to find (in this case "I")
    2 - The cell you are looking in
    3 - Where to start looking (by putting "1" you look at the very start of the cell).

    The TRIM removes any extra spaces (if they exist).


    So for you example:
    The find function, for D21, will return 8, because the "I" is the 8th character in cell D21. we then add a "-1" because you want the first 7 characters to be returned. (if the I was the 9th character, you would want the first 8 characters returned.

    The left function looks at D21 and returns the first X characters of the cell, dependant on what the find function returns. Does that make sense?

  9. #9
    Registered User
    Join Date
    05-06-2013
    Location
    toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: keywoard matching

    Thank you for your help!

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: keywoard matching

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Thanks.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  11. #11
    Registered User
    Join Date
    05-06-2013
    Location
    toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    75

    converting text to a number

    D2
    15/16 IR

    E2
    =ISNUMBER(TRIM(LEFT(D2,FIND("I",D2,1)-1)))


    Hi all, when I perform this function it returns false, how can i make so that the returned value from this formula 15/16 will return as number in this case TRUE?
    Last edited by hk4kim; 05-07-2013 at 09:06 AM.

  12. #12
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: converting text to a number

    =isnumber(value(trim(left(d2,find("i",d2,1)-1))))
    Elegant Simplicity............. Not Always

  13. #13
    Registered User
    Join Date
    05-06-2013
    Location
    toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: converting text to a number

    still get false...

  14. #14
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: converting text to a number

    =isnumber(value(trim(left(d2,find("i",d2,1)-2))))

    It's because Excel is seeing it as a date but you can't have the 15th of the 16th you'll need to break the numbers down by pairs.
    Last edited by AndyLitch; 05-07-2013 at 09:26 AM.

  15. #15
    Registered User
    Join Date
    05-06-2013
    Location
    toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: converting text to a number

    i mean how does 15/1 count as a number while 15/16 does not?

  16. #16
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: converting text to a number

    Quote Originally Posted by hk4kim View Post
    i mean how does 15/1 count as a number while 15/16 does not?
    Because Excel Sees 15/1 as a Date (January 15th)
    And dates are really just serial numbers incrimenting by 1 since january 1 1900.
    But 15/16 does not appear to be a date, so it's just a Text String - Not a number.

  17. #17
    Registered User
    Join Date
    05-06-2013
    Location
    toronto,Canada
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: converting text to a number

    if i do =isnumber(15/16), it returns true

  18. #18
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: converting text to a number

    Because that is being read as 15 devided by 16.
    And it is not encosed in Quotes, so Excel doesn't intially see it as a text string.

    The LEFT function returns a TEXT string.
    Try
    =ISNUMBER("15/16")

    When excel encounters a Text string that looks like it might be a date, then it converts it to a date.
    Last edited by Jonmo1; 05-07-2013 at 09:36 AM.

  19. #19
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: converting text to a number

    because it sees the 1 as January

+ 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