+ Reply to Thread
Results 1 to 5 of 5

If a cell starts with the number 6 or7 or 8 or 9 then delete the last digit of that cell

  1. #1
    Registered User
    Join Date
    09-04-2014
    Location
    UK
    MS-Off Ver
    2003 & 2010
    Posts
    2

    Question If a cell starts with the number 6 or7 or 8 or 9 then delete the last digit of that cell

    Hi guys

    Pretty much as my title says. I have a set of data as below:

    1068349
    9908821
    9886591
    1065885
    9550811
    1082668
    8995951

    I want the output to look like this

    1068349
    990882
    988659
    1065885
    955081
    1082668
    699595

    Is there any formulae that can do this for me or should this be a Macro.
    This would be a massive help to me!

    I have another question however I shall make a new thread for it
    I hope what I need is clear, I have a tendency to suck at explaining things.


    Kind regards and thanks in advanced!
    Philip

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: If a cell starts with the number 6 or7 or 8 or 9 then delete the last digit of that ce

    If the values are always whole numbers with 15 or fewer digits,

    =IF(LEFT(A1)<"6", A1, INT(A1/10))
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: If a cell starts with the number 6 or7 or 8 or 9 then delete the last digit of that ce

    Assuming data starts in A1

    =IF(OR(LEFT(A1)="6",LEFT(A1)="7",LEFT(A1)="8",LEFT(A1)="9"),LEFT(A1,LEN(A1)-1),A1)
    Last edited by Speshul; 09-04-2014 at 03:07 PM.
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

  4. #4
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: If a cell starts with the number 6 or7 or 8 or 9 then delete the last digit of that ce

    [...deleted...]
    Last edited by joeu2004; 09-04-2014 at 03:08 PM. Reason: redundant

  5. #5
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: If a cell starts with the number 6 or7 or 8 or 9 then delete the last digit of that ce

    Or this

    =IF(OR(LEFT(A1)+0={6,7,8,9}),REPLACE(A1,LEN(A1),1,""),A1)+0

    A
    B
    1
    1068349
    1068349
    2
    9908821
    990882
    3
    9886591
    988659
    4
    1065885
    1065885
    5
    9550811
    955081
    6
    1082668
    1082668
    7
    8995951
    899595
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

+ 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. Color a single digit in a mult-digit number cell
    By Phyllis in forum Excel General
    Replies: 8
    Last Post: 09-30-2022, 04:22 PM
  2. [SOLVED] Sorting of a Log Number that starts with a two digit year
    By xltbob in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-19-2012, 05:34 PM
  3. Replies: 19
    Last Post: 06-13-2012, 09:03 AM
  4. [SOLVED] Delete row if cell starts with ...........
    By mohd21uk via OfficeKB.com in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 05-15-2006, 12:55 PM
  5. [SOLVED] Delete file if it starts with a number
    By Michael Smith in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-23-2006, 01:15 PM

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