+ Reply to Thread
Results 1 to 5 of 5

Excel Formula to Extract a Number from a Cell

  1. #1
    Registered User
    Join Date
    07-27-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    12

    Excel Formula to Extract a Number from a Cell

    Hi,

    A couple of days ago I posted a request for help with an if statement based on text search (see link at bottom of this post). Some kind posters gave me the solution I needed, which was the following formula:

    =IF(ISERROR(IF(ISNUMBER(SEARCH("*",H10490)),MID(H10490,1,FIND("*",H10490)-1),S10490))=TRUE,H10490,IF(ISNUMBER(SEARCH("*",H10490)),MID(H10490,1,FIND("*",H10490)-1),H10490))

    However, the problem with this is that the resulting number I get has weird formatting which means I am then unable to carry out a lookup on the number against a list of numbers I have. Does anyone have any thoughts on why this is the case. Even better does anyone have a recommended solution?

    Kind regards

    HA

    P.s. see below for a link to the original request for help:

    http://www.excelforum.com/excel-gene...xt-search.html

  2. #2
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Excel Formula to Extract a Number from a Cell

    Say your sample data is in A1:A4.

    To extract the left hand number, in B1 put this formula:
    Please Login or Register  to view this content.
    Not quite sure if you want the right hand number stored as text or as a true number; in C1 this will make it a true number:
    Please Login or Register  to view this content.
    Note that, because it is a true number, it would be displayed as 5 rather than 05.
    Hope that helps,

    Colin

    RAD Excel Blog

  3. #3
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: Excel Formula to Extract a Number from a Cell

    Or Try the formula:

    =LEFT(A1&"*",FIND("*",A1&"*")-1)
    Best regard, -)iger-/iger
    If you are pleased with a solution mark your post SOLVED.

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

    Re: Excel Formula to Extract a Number from a Cell

    i cant see why you are using that long formula !did you not go back and look at the other suggestions!
    in b1
    =IF(ISNUMBER(FIND("*",A1)),LEFT(A1,FIND("*",A1)-1),A1)
    in c1
    =IF(ISNUMBER(FIND("*",A1)),MID(A1,FIND("*",A1)+1,255),"") just add 0 to get real numbers
    so
    in b1
    =IF(ISNUMBER(FIND("*",A1)),LEFT(A1,FIND("*",A1)-1),A1)+0
    in c1
    =IF(ISNUMBER(FIND("*",A1)),MID(A1,FIND("*",A1)+1,255),"")+0
    "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

  5. #5
    Registered User
    Join Date
    07-27-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Excel Formula to Extract a Number from a Cell

    Many thanks Colin this fixed it. Have a good weekend.

+ 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