How to Replace VLOOKUP Formulas with Static Values in Excel, Skipping Hidden Rows
How to Replace VLOOKUP Formulas with Static Values in Excel, Skipping Hidden Rows
Author: Ada Codewell – AI Specialist & Software Engineer at Gray Technical
Published on: [Date]
The Problem with Replacing VLOOKUP Formulas in Hidden Rows
Many Excel users face a common challenge when working with large datasets that contain hidden rows. When you need to replace formulas like VLOOKUP with their resulting values, the process becomes complicated if some of those formula cells are hidden.
The Root Cause: Why This Happens?
When you copy and paste special (values) in Excel, it affects all selected cells equally. Hidden rows can’t be selectively excluded from this operation using standard methods alone. As a result, formulas in visible cells get replaced with static values along with those in hidden rows.
The Solution: Step-by-Step Guide
Here’s how to replace VLOOKUP (or any other formula) with its resulting value while ignoring the hidden rows:
- Identify Hidden Rows and Columns: First, make sure you know which rows are currently hidden. You can do this by checking row heights or using Excel’s “Go To Special” feature.
- Unhide All Rows Temporarily: Unhide all the rows in your worksheet so that every cell is visible.
Home > Format > Hide & Unhide > Unhide Rows
- Select Specific Columns or Cells with Formulas: Select only those columns where you have VLOOKUP formulas.
- Copy and Paste Special as Values Only for Visible Data:
- Press Ctrl+C to copy the selected cells containing your VLOOKUP formulas.
- Right-click on a blank area of your worksheet or another location where you want these values pasted, and select “Paste Special”.
- Choose ‘Values’ from the Paste Special dialog box. This will replace all visible cell contents with their calculated results while leaving hidden rows untouched.
- Re-hide Any Rows You Initially Had Hidden: Go back and reapply any row hiding that was necessary to maintain your data’s structure.
Home > Format > Hide & Unhide > Hide Rows
- Verify the Results: Check both visible and hidden rows to ensure formulas were replaced with values only in visible cells.
Advanced Tip: Using CelTools for Automation
While you can do this manually, CelTools automates this entire process. It provides a feature to selectively replace formulas with values in visible cells only.
A Practical Example: Event Bar Tracking Workbook
Imagine you’re working on an event bar tracking workbook, and some rows are hidden based on certain criteria (e.g., past events). You need to update the VLOOKUP results for current/future events while keeping historical data intact.
Step-by-Step Example:
- Identify Hidden Rows: Check which rows are hidden by looking at row heights or using “Go To Special”.
- Temporarily Unhide All Rows
- Select Columns with VLOOKUP Formulas Only (e.g., Event Details)
- Copy and Paste as Values for Visible Cells:
- Ctrl+C to copy the selected cells.
- Right-click on a blank area or another location, select “Paste Special”, choose ‘Values’.
- Re-hide Any Initially Hidden Rows: Reapply row hiding as needed to maintain data structure and readability.
- Verify Results in Both Visible and Hidden Cells: Ensure formulas were replaced with values only where visible, leaving hidden rows untouched.
A Second Example: Distribution Tables
Suppose you have multiple distribution tables containing percentages. You need to generate the same distributions using equations manually while ignoring certain hidden cells that should remain as formulas for future updates.
- Identify Hidden Rows in Each Table:
- Temporarily Unhide All Rows: Make sure all rows are visible so you can work with the data easily.
- Select Columns Containing Distribution Formulas Only (e.g., Percentage Calculations)
- Copy and Paste as Values for Visible Cells:
- Ctrl+C to copy the selected cells.
- Right-click on a blank area or another location, select “Paste Special”, choose ‘Values’.
- Re-hide Initially Hidden Rows: Restore any hidden rows that were necessary for data organization and readability.
- Verify Results in Both Visible and Hidden Cells: Ensure formulas are replaced with values only where visible, leaving hidden cells untouched.
A Third Example: Dynamic Workbook Containing Multiple Worksheets
In a dynamic workbook containing multiple worksheets that behave as more than one using a KEY, you may need to replace VLOOKUP formulas with values in specific sheets while ignoring hidden rows. This is particularly useful for maintaining data integrity across different sections of your project.
- Identify Hidden Rows Across Worksheets:
- Temporarily Unhide All Rows: Ensure all cells are visible to facilitate the operation.
- Select Columns with VLOOKUP Formulas Only (e.g., Data Lookup Fields)
- Copy and Paste as Values for Visible Cells:
- Ctrl+C to copy the selected cells.
- Right-click on a blank area or another location, select “Paste Special”, choose ‘Values’.
- Re-hide Initially Hidden Rows: Restore any hidden rows that were necessary for data organization and readability.
- Verify Results in Both Visible and Hidden Cells: Ensure formulas are replaced with values only where visible, leaving hidden cells untouched.
Common Mistakes to Avoid
The following mistakes can lead to data loss or incorrect results when replacing VLOOKUP formulas:
- Not Un-hiding Rows First: Always ensure all rows are visible before attempting the operation.
- Selecting Entire Worksheet Instead of Specific Columns/Rows: This can lead to unintended data replacement in other parts of your sheet.
- Forgetting to Re-hide Rows After Operation: Always restore the hidden rows after completing the operation for proper data organization and readability.
Advanced Variation: Using VBA for Automation
If you frequently need to perform this task, consider using a simple VBA macro. Here’s an example:
Sub ReplaceVLOOKUPWithValues()
Dim ws As Worksheet
Set ws = ActiveSheet
Application.ScreenUpdating = False
' Unhide all rows temporarily
ws.Rows.Hidden = False
' Select columns with VLOOKUP formulas (adjust range as needed)
Range("B2:D10").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
' Re-hide rows that were initially hidden
Dim r As Range
For Each r In ws.UsedRange.Rows.SpecialCells(xlCellTypeHidden)
r.Hidden = True
Next r
Application.ScreenUpdating = True
End Sub
Technical Summary: Combining Manual Techniques with Specialized Tools for Optimal Results
The process of replacing VLOOKUP formulas while ignoring hidden rows can be efficiently managed using a combination of manual techniques and specialized tools like CelTools. This approach ensures data integrity, saves time, and reduces the risk of errors.
By following these steps—temporarily unhiding rows, selectively copying values for visible cells only, re-hiding necessary rows, and verifying results—you can maintain a clean dataset while preserving hidden information. For frequent users or complex scenarios, tools like CelTools provide an automated solution that streamlines this process.
For those who prefer coding solutions, VBA macros offer another efficient way to handle these tasks programmatically.






















