+ Reply to Thread
Results 1 to 4 of 4

Trim help

  1. #1
    Registered User
    Join Date
    01-28-2015
    Location
    CA
    MS-Off Ver
    2007
    Posts
    67

    Trim help

    Hey guys,
    i have part numbers that look like this:


    1283-104-10T
    1283-104-7
    1316-2147-6
    1316-2147-7T

    i need a function that will turn that into
    1283-104
    1283-104
    1316-2147
    1316-2147

    Currently using
    =IF(A3<>"",LEFT(A3,FIND("-",A3)+4),"")

    BUT some of the part numbers have 3 in the middle and some have 4
    all help would be greatly appreciated!
    Last edited by BlakeSkate; 05-15-2015 at 04:49 PM.

  2. #2
    Forum Guru Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Trim help

    Maybe this...

    Data Range
    A
    B
    1
    1283-104-10T
    1283-104
    2
    1283-104-7
    1283-104
    3
    1316-2147-6
    1316-2147
    4
    1316-2147-7T
    1316-2147


    This formula entered in B1 and copied down:

    =TRIM(LEFT(SUBSTITUTE(A1,"-",REPT(" ",25),2),20))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    01-28-2015
    Location
    CA
    MS-Off Ver
    2007
    Posts
    67

    Re: Trim help

    Perfect!
    Sorry for the late response i had the flu

  4. #4
    Forum Guru Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Trim help

    You're welcome. Thanks for the feedback!

+ 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] VBA TRIM is won't TRIM active worksheet
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-06-2014, 09:55 AM
  2. Trying to trim a trailing space char and the Trim function isn't working
    By Psychochook in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2007, 11:28 PM
  3. trim function-how would one incorporate the trim function within the if statement?
    By specter@doom.com in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-29-2005, 11:10 PM
  4. trim
    By geza in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-05-2005, 10:05 PM
  5. VBA Trim and Application.worksheetfunction.Trim
    By Hari Prasadh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-19-2005, 11:06 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