+ Reply to Thread
Results 1 to 9 of 9

Delete 4 to 5 digits from left in a cell

  1. #1
    Forum Contributor
    Join Date
    02-19-2004
    Location
    San Francisco Bay Area
    MS-Off Ver
    Microsoft 365 Aps for enterprise.
    Posts
    241

    Delete 4 to 5 digits from left in a cell

    Hi,
    I got a sheet where I need to delete number followed by ':'. All these numbers are at the left in a cell like this---> 300: text.... few hundred rows. Any help please?
    Aziz

  2. #2
    Peo Sjoblom
    Guest

    Re: Delete 4 to 5 digits from left in a cell

    If : only occurs once per cell, select the column, do data>text to columns,
    select delimited and click next, select other and put : in the other box,
    click next, select the left column in the data preview (should be black)
    which is the default, then select do not import (skip) and click finish

    --

    Regards,

    Peo Sjoblom

    http://nwexcelsolutions.com


    "saziz" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi,
    > I got a sheet where I need to delete number followed by ':'. All these
    > numbers are at the left in a cell like this---> 300: text.... few
    > hundred rows. Any help please?
    > Aziz
    >
    >
    > --
    > saziz
    > ------------------------------------------------------------------------
    > saziz's Profile:
    > http://www.excelforum.com/member.php...fo&userid=6350
    > View this thread: http://www.excelforum.com/showthread...hreadid=536939
    >




  3. #3
    Toppers
    Guest

    RE: Delete 4 to 5 digits from left in a cell

    With data in A1, in B1 put


    =TRIM(MID(A1,FIND(":",A1)+1,255))

    copy down

    "saziz" wrote:

    >
    > Hi,
    > I got a sheet where I need to delete number followed by ':'. All these
    > numbers are at the left in a cell like this---> 300: text.... few
    > hundred rows. Any help please?
    > Aziz
    >
    >
    > --
    > saziz
    > ------------------------------------------------------------------------
    > saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350
    > View this thread: http://www.excelforum.com/showthread...hreadid=536939
    >
    >


  4. #4
    Forum Contributor
    Join Date
    02-19-2004
    Location
    San Francisco Bay Area
    MS-Off Ver
    Microsoft 365 Aps for enterprise.
    Posts
    241
    Peo Sjoblom,
    Thank you! It worked perfectly.
    Regards

    Aziz

  5. #5
    Forum Contributor
    Join Date
    02-19-2004
    Location
    San Francisco Bay Area
    MS-Off Ver
    Microsoft 365 Aps for enterprise.
    Posts
    241
    Toppers,
    That worked too. Now instead on the same sheet I am trying this on sheet2 giving this code. =TRIM(MID(Sheet1!B2,FIND(":",B2)+1,255)) It does not work. I don't know why. Any idea?
    Thanks
    Aziz

  6. #6
    Bob Phillips
    Guest

    Re: Delete 4 to 5 digits from left in a cell


    iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
    For i = 1 To iLastRow
    With Cells(i,"A")
    iPos = InStr(":",.Value)
    if iPos > 0 Then
    .Value = Right(.Value, Len(.Value) - iPos)
    End If
    End With
    Next i

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "saziz" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi,
    > I got a sheet where I need to delete number followed by ':'. All these
    > numbers are at the left in a cell like this---> 300: text.... few
    > hundred rows. Any help please?
    > Aziz
    >
    >
    > --
    > saziz
    > ------------------------------------------------------------------------
    > saziz's Profile:

    http://www.excelforum.com/member.php...fo&userid=6350
    > View this thread: http://www.excelforum.com/showthread...hreadid=536939
    >




  7. #7
    Forum Contributor
    Join Date
    02-19-2004
    Location
    San Francisco Bay Area
    MS-Off Ver
    Microsoft 365 Aps for enterprise.
    Posts
    241
    Hi Bob,
    I fix my problem, thank you. But wanted to try your code.
    At this line: For i = 1 To Len(a) it gives me an error "Invalid outside procedure"
    I don't know what is.
    Aziz

  8. #8
    Toppers
    Guest

    Re: Delete 4 to 5 digits from left in a cell



    =TRIM(MID(Sheet2!A1,FIND(":",Sheet2!A1)+1,255))

    "saziz" wrote:

    >
    > Toppers,
    > That worked too. Now instead on the same sheet I am trying this on
    > sheet2 giving this code. =TRIM(MID(Sheet1!B2,FIND(":",B2)+1,255)) It
    > does not work. I don't know why. Any idea?
    > Thanks
    > Aziz
    >
    >
    > --
    > saziz
    > ------------------------------------------------------------------------
    > saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350
    > View this thread: http://www.excelforum.com/showthread...hreadid=536939
    >
    >


  9. #9
    Bob Phillips
    Guest

    Re: Delete 4 to 5 digits from left in a cell

    You need to put it in a macro, for instance

    Sub RemoveData()
    iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
    For i = 1 To iLastRow
    With Cells(i,"A")
    iPos = InStr(":",.Value)
    if iPos > 0 Then
    .Value = Right(.Value, Len(.Value) - iPos)
    End If
    End With
    Next i
    End Sub

    then run RemoveData

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "saziz" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi Bob,
    > I fix my problem, thank you. But wanted to try your code.
    > At this line: For i = 1 To Len(a) it gives me an error "Invalid outside
    > procedure"
    > I don't know what is.
    > Aziz
    >
    >
    > --
    > saziz
    > ------------------------------------------------------------------------
    > saziz's Profile:

    http://www.excelforum.com/member.php...fo&userid=6350
    > View this thread: http://www.excelforum.com/showthread...hreadid=536939
    >




+ 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