Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Replace first part of SS# with x's (XXXX-XX-9999)

I am trying to write a code that will take the full social securit
number 9999-99-9999 and turn it into the following: XXXX-XX-9999, th
first numbers can be deleted, with only the last four remaining. I kno
this is really simple for you pros out there, but I cannot do it!
Please help me!

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Replace first part of SS# with x's (XXXX-XX-9999)

Hi Jenpher ,

I am trying to write a code that will take the full social security
number 9999-99-9999 and turn it into the following: XXXX-XX-9999, the
first numbers can be deleted, with only the last four remaining. I
know this is really simple for you pros out there, but I cannot do
it!! Please help me!!


I'm assuming you mean xxx-xx-9999, as the standard SSN has 3 digits, a
hyphen, 2 digits, a hypen, then 4 digits.

Here's a function that will do that for you:

Public Function gsMaskSSN(rsOrigSSN As String) As String
If rsOrigSSN Like "###-##-####" Then
gsMaskSSN = "xxx-xx-" & Right$(rsOrigSSN, 4)
Else
Err.Raise 10001, "gsMaskSSN", "Invalid SSN"
End If
End Function

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Replace first part of SS# with x's (XXXX-XX-9999)

I've looked a lot of places but I don't know where to paste it and the
apply the format afterwards. Any help is very, very appreciated. Than
you!

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Replace first part of SS# with x's (XXXX-XX-9999)

Hi Jenpher ,

I've looked a lot of places but I don't know where to paste it and
then apply the format afterwards. Any help is very, very appreciated.
Thank you!!


Most code goes in a Standard Module. To create one, open the VBE (Alt+F11
from Excel), then select Insert | Module. You can paste the code in there.

The code I gave you was set up as a function. This means that you pass in
one or more values, and the function returns a value to you. The code used
to pass in the SSN will vary depending on what it is you're trying to
accomplish. Where are the SSNs stored, and how do you want them outputted?
Or do you just want to take all SSNs in a worksheet and mask them using this
function? Do you need to retain the original values somewhere?

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Replace first part of SS# with x's (XXXX-XX-9999)

no messag

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Replace first part of SS# with x's (XXXX-XX-9999)

Jenpher

If "the first numbers can be deleted"......

In an adjacent column enter

=RIGHT(A1,4) and drag/copy down.

Assumes Column A has your SSN's

When done, you can copy the column and paste specialvaluesOKEsc

Delete the original column.

Gord Dibben Excel MVP



On Wed, 5 May 2004 13:06:12 -0500, Jenpher
wrote:

I am trying to write a code that will take the full social security
number 9999-99-9999 and turn it into the following: XXXX-XX-9999, the
first numbers can be deleted, with only the last four remaining. I know
this is really simple for you pros out there, but I cannot do it!!
Please help me!!


---
Message posted from http://www.ExcelForum.com/


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Replace first part of SS# with x's (XXXX-XX-9999)

.... or

="XXX-XX-"&RIGHT(A1,4)

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Gord Dibben wrote:

Jenpher

If "the first numbers can be deleted"......

In an adjacent column enter

=RIGHT(A1,4) and drag/copy down.

Assumes Column A has your SSN's

When done, you can copy the column and paste specialvaluesOKEsc

Delete the original column.

Gord Dibben Excel MVP



On Wed, 5 May 2004 13:06:12 -0500, Jenpher
wrote:


I am trying to write a code that will take the full social security
number 9999-99-9999 and turn it into the following: XXXX-XX-9999, the
first numbers can be deleted, with only the last four remaining. I know
this is really simple for you pros out there, but I cannot do it!!
Please help me!!


---
Message posted from http://www.ExcelForum.com/




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format a number (i.e. 1111111111111111) to show XXXX-XXXX-1111-11 rjbind Excel Discussion (Misc queries) 1 July 13th 07 03:45 AM
replace last four of ssn with xxxx mary s Excel Discussion (Misc queries) 5 May 5th 06 10:35 PM
adding a ' ie 'xxxx instead of xxxx cclambie Excel Worksheet Functions 6 December 6th 05 04:25 AM
change dots to dashes in an account format (xx.xxxx.xxxx) to xx-xx Michael Excel Discussion (Misc queries) 1 July 1st 05 10:44 PM
within a macro how can I suppress the warning pop "A file named xxxx.xls already exists in this location. Do you want to replace it?" Pete McCosh Excel Programming 0 April 2nd 04 04:51 PM


All times are GMT +1. The time now is 04:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"