Encrypt Cells in a Worksheet

mbuenger

New Member
Joined
Apr 24, 2015
Messages
9
I am trying to create a spreadsheet that contains personal sensitive information, in this case, Social Security Numbers. Individuals will be asked to enter information, including their SSN. However, I want the SSN to be automatically encrypted once the user fills in the number. The number would show as “****-**-****” instead of the actual number. Much like when you supply passwords when logging into website and such. What options do I have and how do I apply to the workbook?

Example of table layout:
NamePositionRegionSSN
1JackSalesmanWest***-**-****
2JillSalesmanNorth***-**-****
3TomSalesmanSouth***-**-****
4JerrySalesmanEast***-**-****

<colgroup><col><col><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Sounds more like masking values and not encryption. You can use a combination of value format and data validation for that.

For example if I select range A2:A8 and specify custom format type:
"***-**-****";"***-**-****";"***-**-****";"***-**-****"
and on same cells, apply data validation with custom formula:
=AND(LEN(A2)=11, LEN(SUBSTITUTE(A2, "-", ""))=9,NOT(ISERROR(VALUE(SUBSTITUTE(A2, "-", "")))))

I get following output in my spreadsheet:

A
1Masked
2***-**-****
3***-**-****
4***-**-****
5***-**-****
6***-**-****
7***-**-****
8***-**-****

<tbody>
</tbody>
 
Last edited:
Upvote 0
I explored the cell formatting and it works for what it is worth, but any user in the spreadsheet can still see the number by going to the formula bar. I need a solution that completely masks the number altogether until the owner uses a password or other method to unmask. Any other ideas?
 
Upvote 0
Hi. I don't know where my prior response is, but I would like to ask you to please break down this formula and how it works and why you chose AND over OR.
Thanks!
 
Upvote 0
You can set column cells as Locked and then password protect the sheet (uncheck "Select locked cells" option) so that user cannot click on the column to see the values.
 
Upvote 0
Hi. I don't know where my prior response is, but I would like to ask you to please break down this formula and how it works and why you chose AND over OR.
Thanks!

The data validation formula is checking the value for 3 things:

1. Length of input value is 11 characters (including hyphens)
2. Length of input value is 9 characters (excluding hyphens)
3. The value obtained after removing hyphens should be completely numeric. (just my thought)

All three of these conditions must be true for the input value to qualify as valid input value; therefore AND function is applied. Applying OR would mean the value is valid if even one of the conditions is true.
 
Last edited:
Upvote 0
The data validation formula is checking the value for 3 things:

1. Length of input value is 11 characters (including hyphens)
2. Length of input value is 9 characters (excluding hyphens)
3. The value obtained after removing hyphens should be completely numeric. (just my thought)

All three of these conditions must be true for the input value to qualify as valid input value; therefore AND function is applied. Applying OR would mean the value is valid if even one of the conditions is true.

Thanks for the response.

I understand number one, but I don't see why this can't be an "OR". I'm not a guru (hence, why I joined this forum), but doesn't making it an AND prevent you from getting a TRUE if it has to meet both conditions of 11 characters AND 9 characters. Does Excel know that you mean including or excluding hyphens because of the SUBSTITUTE formula.

And the NOT part is good for what exactly?
 
Upvote 0
NOT is to check if converting value to a number causes an error (because of non-numeric characters).

And it is AND which ensures that each condition must be true to evaluate to true. Applied SUBSTITUTE formula removes all hyphens in the value leaving (hopefully) only the numbers. Here are some values as example:


InputWith ANDWith OR
123-46-448aFALSETRUE
554-87+8965FALSETRUE
12345687900FALSETRUE
132-56-5587-FALSETRUE
456-784-455TRUETRUE

<tbody>
</tbody>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,315
Messages
6,124,211
Members
449,148
Latest member
sweetkt327

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top