+ Reply to Thread
Results 1 to 7 of 7

Left Formula which removes unnecessary characters and will display content if only one

Hybrid View

  1. #1
    Registered User
    Join Date
    12-10-2013
    Location
    Irvine, CA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Left Formula which removes unnecessary characters and will display content if only one

    I'm working on a formula that shows only the left numbers before a space. But I also need all commas and periods removed as well as show the value in the cell if there is only one number. So far I'm this far on the formula, but I'm getting #value if the originating cells has only one number in it, but I need that number to show if that is the only number...

    =SUBSTITUTE(SUBSTITUTE(LEFT(A3,SEARCH(" ",A3,1)),",",""),".","")

    How to add "show numbers in cell if no other numbers". Here is what it looks like now...

    Original Numbers Need to show only left most numbers
    355.5, 355.8, 355.3, 355.5	3555 
    355.8				#VALUE!
    355, 355.8, 355.3, 355.5	355 
    735				#VALUE!
    735, 735.4, 736.72, 838.01	735 
    728.71				#VALUE!
    355.8, 355, 355.3, 355.5	3558 
    735.2				#VALUE!
    355.8				#VALUE!
    232.8				#VALUE!
    355.8, 956.2, 976.1, 338.49	3558
    Please help. Thanks.

    ~A

    Moderator's note: Welcome to the Forum--I helped you out with formatting--6SJ
    Last edited by 6StringJazzer; 12-10-2013 at 08:48 PM. Reason: formatting

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Left Formula which removes unnecessary characters and will display content if only one

    welcome to the forum, arodgers. maybe:
    =INT(SUBSTITUTE(LEFT(A3,FIND(" ",A3&" ")-1),",",""))

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    27,026

    Re: Left Formula which removes unnecessary characters and will display content if only one

    I had success with this.

    Formula: copy to clipboard
    =IFERROR(SUBSTITUTE(LEFT(A1,FIND(",",A1)-1),".",""),SUBSTITUTE(A1,".",""))


    It makes the following assumptions based on your example:
    1. The first number in a list is immediately followed by a comma
    2. If there is only a single number, there are no commas, spaces, or other characters in the cell
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Registered User
    Join Date
    12-10-2013
    Location
    Irvine, CA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Left Formula which removes unnecessary characters and will display content if only one

    Thanks guys, thats so close, but I just need it to remove the periods, =INT(SUBSTITUTE(LEFT(A3,FIND(" ",A3&" ")-1),",","")) this formula drops everything after the period, I need the number if it 355.8 to show as 3558.

    Thanks so much guys!

  5. #5
    Registered User
    Join Date
    12-10-2013
    Location
    Irvine, CA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Left Formula which removes unnecessary characters and will display content if only one

    That one work! Thanks guys, you are awesomesauce! Or should I say awsomesource?

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Left Formula which removes unnecessary characters and will display content if only one

    This seems to work with your example:

    Formula: copy to clipboard
    =SUBSTITUTE(SUBSTITUTE(LEFT(A3,SEARCH(" ",A3,1)),".",""),",","")
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

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

    Re: Left Formula which removes unnecessary characters and will display content if only one

    try
    =LOOKUP(9.99E+307,--MID(SUBSTITUTE(SUBSTITUTE(A1,".",""),","," "),MIN(FIND({1,2,3,4,5,6,7,8,9,0},SUBSTITUTE(SUBSTITUTE(A1,".",""),","," ")&1234567890)),ROW(INDIRECT("1:"&LEN(A1)))))
    "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

+ 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] formula if cell content doen not equal certain amount of characters
    By Marijke in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-25-2013, 11:19 AM
  2. Use LEFT formula to extract text preceding ONE OF TWO possible characters
    By potejam in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-22-2013, 08:05 PM
  3. Macro that removes cariable before set characters
    By Tim A in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-27-2012, 09:25 AM
  4. [SOLVED] remover characters from left & right excel formula
    By boldcode in forum Excel General
    Replies: 4
    Last Post: 08-22-2011, 04:27 PM
  5. Unnecessary Blank Characters in Cells in Excel 2007
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 11-19-2007, 11:22 AM

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