Forum Discussion

IvanNsoh's avatar
IvanNsoh
Copper Contributor
May 23, 2024

Go to Special > Blank

Hi guys,

I have been struggling with finding all blank cells in my data set so I can replace with #N/A. Whenever I go through the 'go to special' process and select 'blank', None of the blank cells are highlighted. How do I fix this? Thanks

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    IvanNsoh 

    If the 'Go to Special' > 'Blank' feature in Excel is not highlighting your blank cells, it might be because those cells are not truly blank but contain invisible characters or formulas returning empty strings. Here are steps to troubleshoot and fix this issue:

    Step-by-Step Guide to Identifying and Replacing Blanks

    1. Check for Hidden Characters: Sometimes cells appear blank but contain spaces, apostrophes, or other non-visible characters.
      1. Select the range of cells.
      2. Use Find and Replace (Ctrl + H).
      3. In the Find what: field, enter a space ( ) or apostrophe (').
      4. Leave the Replace with: field blank.
      5. Click Replace All.
      • Remove Spaces and Apostrophes:
    2. Identify Cells with Formulas Returning Empty Strings: Cells with formulas like =IF(A1="","",A1) return an empty string but are not considered blank.
      1. Select the range of cells.
      2. Copy the range (Ctrl + C).
      3. Right-click and select Paste Special > Values.
      • Convert Formula Results to Values:
    3. Use a Helper Column to Identify Truly Blank Cells: Create a helper column to check if cells are truly blank.
    1. In an adjacent column, use the formula:

    =IF(A1="", TRUE, FALSE)

    1. Drag the formula down to cover your range.
    2. Filter the helper column for TRUE.
    3. Replace these filtered cells with #N/A.

    4. Manually Identify and Replace Blanks Using a Macro: If the above steps don’t resolve the issue, a macro can help identify and replace blank cells.

    Vba Code is untested, please backup your file.

     

    Sub ReplaceBlanksWithNA()
        Dim ws As Worksheet
        Dim cell As Range
        Dim rng As Range
    
        ' Set the worksheet
        Set ws = ActiveSheet
    
        ' Define the range (change A1:Z100 to your range)
        Set rng = ws.Range("A1:Z100")
    
        ' Loop through each cell in the range
        For Each cell In rng
            ' Check if the cell is empty or contains an empty string
            If IsEmpty(cell.Value) Or cell.Value = "" Then
                cell.Value = "#N/A"
            End If
        Next cell
    End Sub

     

    How to Use the Macro:

    1. Press Alt + F11 to open the VBA editor.
    2. Click Insert > Module.
    3. Paste the above code into the module window.
    4. Close the VBA editor.
    5. Press Alt + F8, select ReplaceBlanksWithNA, and click Run.

    Additional Tips

    • Ensure Consistent Data Types: Sometimes, Excel has issues with mixed data types (text and numbers). Make sure your data set is consistent.
    • Check for Conditional Formatting: Conditional formatting can sometimes cause issues. Clear any conditional formatting and try again.
    • Clear Filters: Ensure no filters are applied to the data set before using 'Go to Special'.

    By following these steps, you should be able to identify and replace blank cells effectively in your Excel data set.If none of these steps help you, I recommend adding more information to your topic. Information such as Excel version, operating system, storage medium, file extension, etc.

    In this link you will find some more information about it:

    Welcome to your Excel discussion space!

    The text and steps were edited with the help of AI.

     

    My answers are voluntary and without guarantee!

     

    Hope this will help you.

    Was the answer useful? Mark as best response and Like it!

    This will help all forum participants.

Resources