5 Ways to Redact in Microsoft Excel

Do you want to learn how to redact in Microsoft Excel? Follow along with the methods listed here.

If you’ve ever handled confidential reports, HR records, or financial summaries, you know the importance of redacting sensitive information before sharing a file. It’s similar to preparing a client document or legal draft, where anything private must be blacked out or hidden.

But redacting in Microsoft Excel isn’t as straightforward as it is in Word or PDF tools. There’s no one-click Redact button, and that can be frustrating when you’re working under a deadline.

That’s where this tutorial comes in. I’ll walk you through several effective ways to redact in Excel, step by step. I’ve got every popular method covered for you. Keep reading.

Using the Find and Replace Tool

Redacting data using the Find and Replace tool in Microsoft Excel is a fast and flexible method. It’s convenient when you need to mask or remove the same piece of sensitive information across a large worksheet.

Instead of going cell by cell, this approach allows you to search for specific names, numbers, codes, or phrases and instantly replace them with neutral placeholders like REDACTED or XXXX. It works on entire sheets, selected ranges, or even the whole workbook, giving you complete control over what to conceal.

This method is suitable for you since you’re just learning Microsoft Excel or only know the basics of this spreadsheet app. You don’t need to remember any function or its arguments. You only need to know where the Find and Replace tool is, how to call it, or how to use it using its Excel shortcut key. Now let’s get started and don’t forget to create a copy of your workbook, which you can use as a backup:

Find and Replace dialog
Find and Replace dialog

Open your Excel worksheet and press Ctrl + H to bring up the Find and Replace window.

Find & Select
Find & Select

You can also go to the Home tab, click Find & Select, and then choose Replace from the drop-down.

Replace content
Replace content

In the Find what box, type the sensitive data you want to redact. This could be a word, number, or even a part of a phrase. Make sure it’s exactly what appears in the cell to avoid mismatches.

In the Replace with box, type what you want to show instead. Commonly, you can use REDACTED, XXXX, ####, ****, β–ˆ β–ˆ β–ˆ β–ˆ, or any other special character you like.

Double-check your replacement term so it’s consistent across the dataset.

Click Options if needed to refine your search, such as matching the entire cell contents or choosing whether to search within formulas. This helps you avoid accidental replacements in unintended places.

Click on the Within drop-down list and select between Sheet or Workbook. When you select Sheet, the Find and Replace tool works on the active worksheet. However, when you choose Workbook, Excel replaces content with redaction characters in the whole worksheet.

Replace one block
Replace one block

Hit the Replace button, which will replace the first occurrence of the content you want to redact with a redaction character.

Redacted all blocks
Redacted all blocks

Check how the replacement worked. If it looks perfect, hit the Replace All button in the Find and Replace tool.

Congratulations! You have successfully redacted in Excel using the Find and Replace tool.

Using Custom Number Formatting

Using Custom Number Formatting to redact in Microsoft Excel is a clever way to hide sensitive numerical data without actually deleting it. This method doesn’t remove the values from the cells. It simply hides them from view by altering how the content is displayed.

So even though the data still exists in the cell, what you see on the screen appears blank or masked. It’s a practical approach when you want to keep the original data intact but make it invisible during presentation or while sharing the file.

This method is handy when you don’t want to destroy or overwrite anything. You want to make the worksheet or workbook ideal for internal reviews and temporary redaction. Let’s get started practicing this method using these easy steps:

Right click context menu
Right-click context menu

First, select the cell or range of cells that contains the sensitive data you want to hide. You can do this by clicking and dragging over the cells with your mouse.

Right-click anywhere on the selected area and choose Format Cells from the context menu. This opens a new dialog box with multiple formatting options.

Bring up Format Cells
Bring up Format Cells

Alternatively, you can press Ctrl + 1 to bring up the Format Cells dialog box after selecting the source data you want to redact.

In the Format Cells window, go to the Number tab if it’s not already selected by default. Then click on the Custom Category from the list on the left-hand side.

In the Type field, delete any existing format and type in three semicolons, like this: ;;; (no spaces).

Redacted data using Custom formatting
Redacted data using Custom formatting

This formatting code tells Excel to hide everything in the cell from view, regardless of the value.

Using redact box
Using redact box

You can also replace the three semicolons with the black square (β– ). This will give the classic redaction look in your worksheet.

Redacted data using redact box
Redacted data using redact box

Click OK to apply the format to your selected cells. Instantly, the content becomes invisible on the worksheet, although it still exists in the formula bar when a cell is selected.

Short Date formatting
Short Date formatting

If you ever need to bring the data back into view, just repeat the same steps and choose a standard format like General or Number instead. This makes the method reversible and safe for temporary redactions.

Before sharing the file, make sure the cells you’ve hidden are not referenced by other formulas in a visible area. That ensures your redacted values don’t accidentally show up somewhere else in the worksheet.

Using Conditional Formatting to Mask Cells

Using Conditional Formatting to redact in Microsoft Excel is a smart way that visually masks sensitive data based on some conditions. Instead of permanently changing or deleting the values, you apply formatting rules that change how the data appears, like turning the text color the same as the cell background or blocking it with fill color.

Also, this is an automatic way to redact in Excel. For example, if you set the tool to mask date of birth formats, every time a data entry operator enters such values in the Excel sheet, it’ll mask the value instantly.

Now, let’s find out below how to use this method in simple steps:

First, select the range of cells you want to mask using your mouse or keyboard shortcuts like Shift + Arrow keys. Make sure your selection includes only the data you want conditionally redacted.

New Rule
New Rule

Go to the Home tab on the ribbon, click on Conditional Formatting, and then choose New Rule from the dropdown list. This opens a dialog box where you can define the condition that triggers the masking.

New Formatting Rule
New Formatting Rule

In the New Formatting Rule window, select Use a formula to determine which cells to format. Now, in the formula box, enter a logical expression like the one given below:

=ISNUMBER(SEARCH("NASA",A1))
Font color
Font color

After entering your condition, click the Format button on the right side of the dialog box. This opens another window where you can choose how to mask the content visually.

In the Format Cells window, go to the Font tab and set the font color to match the cell background, usually white on white or black on black.

Fill color
Fill color

Now, switch to the Fill tab and choose a solid color like black to simulate redaction blocks.

Use a formula to determine which cells to format
Use a formula to determine which cells to format

Click OK to confirm the formatting, then click OK again to apply the rule. You’ll now see the specified cells appear blank or masked whenever the condition is true.

Redacted using Conditional Formatting
Redacted using Conditional Formatting

To test it, change a few values so the condition is met or not met. The redaction effect will update automatically, which helps you double-check if it’s working correctly.

Now, find below a few more Conditional Formatting formulas that you can use to redact content in Excel:

  1. It redacts cells that mention SSN, typically used in headers or notes involving Social Security Numbers.
=ISNUMBER(SEARCH("SSN",A1))
  1. Use this formula to redact cells containing email addresses, as they almost always contain @.
=ISNUMBER(SEARCH("@",A1))
  1. Redacts SSNs or similar formats like 452-19-7832; numbers with dashes, validated by checking the digit-only after removing dashes.
=ISNUMBER(SEARCH("-",A1))*ISNUMBER(SUBSTITUTE(A1,"-","")*1)
  1. This code redacts high-value financial amounts, e.g., anything over $100,000 in a budget or salary sheet.
=AND(ISNUMBER(A1),A1>100000)
  1. Use this code to redact cells that mention Date of Birth, typically column headers or notes.
=ISNUMBER(SEARCH("DOB",A1))
  1. Redacts text that includes credit card references, such as Card No, Credit Card, or similar labels.
=ISNUMBER(SEARCH("Card",A1))

Using Shapes Before Printing Worksheets

Sometimes you need to redact some content from a small dataset in an Excel worksheet just before printing. And that too, you don’t have much time to use any formulas or formatting tools.

In such a situation, you can use a box shape in Excel and format it in black to mimic redacting. Once the printing is done, you can remove these shapes to get back the original worksheet. This method is only suitable for a small dataset. Let me show you how it’s done:

Select Shape
Select Shape

Click on the Insert tab in the Excel ribbon at the top of the screen. Then choose Shapes, and select the rectangle shape from the drop-down menu.

Draw shape
Draw shape

Move your mouse cursor to the worksheet and click and drag to draw the rectangle over the cell or group of cells you want to redact. Adjust the size so it completely covers the data you want to block.

Format Shape
Format Shape

Once the rectangle is in place, right-click it and choose Format Shape from the context menu.

Format Shape solid fill
Format Shape solid fill

In the pane that appears on the right, go to Fill, and select a solid color, like black. Also, do the same in the Line section.

No Outline for shape
No Outline for shape

While still in the Format Shape pane, go to Line or Border settings and choose No Line to avoid outlines around your redaction box.

Finly adjust shape
Finly adjust shape

If the rectangle isn’t perfectly aligned, click and drag it into position, or use the arrow keys on your keyboard for fine-tuning.

You can also hold down Alt while dragging to snap the shape precisely to the cell edges.

Print preview
Print preview

Before printing or exporting, press Ctrl + P and preview the sheet to ensure the redacted areas are fully covered. If the shapes are misaligned or missing, go back and adjust their position to ensure complete coverage.

Using Excel VBA

Finally, you can use Excel VBA to automatically redact various number formats and selective text strings in Excel using a VBA script-based macro. This method is user-friendly because it’ll walk you through step by step.

Before you can try this method, go through how to create a macro using a script by following along with this simple Excel guide:

Now that you know the steps to create a macro, use this VBA script to set up a macro:

VBA script
VBA script
Sub RedactData()
    Dim ws As Worksheet
    Dim cell As Range
    Dim redactedCount As Long
    Dim inputText As String
    Dim keyword As Variant
    Dim regex As Object
    Dim matchPattern As String
    Dim originalText As String
    Dim redactedText As String
    Dim patterns As Variant
    Dim i As Long

    Set ws = ActiveSheet
    redactedCount = 0

    ' Ask user for manual keywords to redact (comma-separated)
    inputText = InputBox("Enter text values to redact, separated by commas (e.g., confidential, secret, SSN):", "Text Redaction")

    ' Define all regex patterns as an array
   patterns = Array("\b\d{1,2}[-/\.]\d{1,2}[-/\.]\d{2,4}\b", "\b\d{3}-\d{2}-\d{4}\b", "\b\d{4}[\s\-]\d{4}[\s\-]\d{4}[\s\-]\d{4}\b", "\b\d{5}(?:-\d{4})?\b", "\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b")

    Set regex = CreateObject("VBScript.RegExp")
    regex.Global = True
    regex.IgnoreCase = True

    ' Loop through all cells in used range
    For Each cell In ws.UsedRange.Cells
        If Not IsEmpty(cell.Value) And VarType(cell.Value) = vbString Then
            originalText = cell.Value
            redactedText = originalText

            ' Loop through each pattern and apply redaction
            For i = LBound(patterns) To UBound(patterns)
                regex.Pattern = patterns(i)
                If regex.Test(redactedText) Then
                    redactedText = regex.Replace(redactedText, "¦¦¦¦")
                End If
            Next i

            ' Apply keyword-based redaction if any entered
            If Len(Trim(inputText)) > 0 Then
                For Each keyword In Split(inputText, ",")
                    keyword = Trim(keyword)
                    If Len(keyword) > 0 Then
                        redactedText = Replace(redactedText, keyword, "¦¦¦¦", , , vbTextCompare)
                    End If
                Next keyword
            End If

            ' If content changed, update the cell
            If redactedText <> originalText Then
                cell.Value = redactedText
                redactedCount = redactedCount + 1
            End If
        End If
    Next cell

    MsgBox redactedCount & " cell(s) redacted.", vbInformation, "Redaction Complete"
End Sub
Macro dialog
Macro dialog

When the macro is ready, press Alt + F8 to launch the Macro dialog box and select the RedactData macro. Hit Run to execute.

Text strings comma separated
Text strings comma-separated

The VBA macro will show a dialog box where you can enter multiple text strings or numbers you want to redact. Use a comma as the separator when entering multiple inputs.

Redacted in Excel using VBA
Redacted in Excel using VBA

The VBA macro will redact the rest of the number formats automatically, like SSNs, DOBs, numericals in addresses, ZIP codes, IP addresses, and so on.

πŸ“š Read more: If you liked this Microsoft Excel guide, you must also take a look at the following:

Conclusions

So, these are some of the best methods to redact data in Excel. You can use the method that suits your work the most.

If you’ve found this Excel tutorial useful, write a message in the comment box. Also, don’t forget to share the guide with your friends and colleagues.

About the Author

Bipasha Nath

Bipasha Nath

Bipasha is a technical content writer with 10+ years of experience in the technology industry. She previously worked in a SaaS software development company focused on SharePoint, OneDrive, Word, Excel, Word solutions.

Related Posts

Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get the Latest Microsoft Excel Tips