+ Reply to Thread
Results 1 to 4 of 4

Formula to use first 3 and last 4 characters of a word

  1. #1
    Registered User
    Join Date
    11-30-2012
    Location
    Colorado
    MS-Off Ver
    Excel 2007
    Posts
    1

    Formula to use first 3 and last 4 characters of a word

    So I am trying to format a list of data given to me. Example below

    ABC123456789

    I am fairly new to excel, but I am trying to figure out how to combine or make a formula to format the data to something like below.

    ABCXXXXX6789

    I need the digits in between X'd out or *'d out. But I need the formula to include the first 3 and last 4 characters. I figure it has something to do with LEFT, RIGHT, and CONCATENATE formulas, but I can't figure this out. Any help is greatly appreciated!

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,703

    Re: Formula to use first 3 and last 4 characters of a word

    Assuming that is in A1, you could use this formula (say in B1):

    =LEFT(A1,3)&REPT("X",LEN(A1)-7)&RIGHT(A1,4)

    The & symbol is the concatenation operator (for joining strings) - quicker to type than the function.

    Hope this helps.

    Pete

  3. #3
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Formula to use first 3 and last 4 characters of a word

    If ABC12345679 is in cell A1, you could use this: =LEFT(A1,3)&"XXXXX"&RIGHT(A1,4)

    - Moo

  4. #4
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Formula to use first 3 and last 4 characters of a word

    =replace(a1,4,5,rept("x",5))

+ 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