How to find where a certain named range is used in Excel?
After creating a named range, you may use this named range in many cells and formulas. But how to find out these cells and formulas in current workbook? This article introduces three tricky ways to solve it easily.
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
We can easily apply Excel’s Find and Replace feature to find out all cells applying the certain named range. Please do as follows:
1. Press the Ctrl + F keys simultaneously to open the Find and Replace dialog box.
Note: You can also open this Find and Replace dialog box with clicking the Home > Find & Select > Find.
2. In the opening Find and Replace dialog box, please do as following screenshot shown:
(1) Type the name of certain named range into the Find what box;
(2) Select Workbook from the Within drop down list;
(3) Click the Find All button.
Note: If the Within drop down list is invisible, please click the Options button to expand the searching options.
Now you will see all cells containing the name of specified named range are listing at the bottom of Find and Replace dialog box. See screenshot:
Note: The Find and Replace method not only finds out all cells using this certain named range, but also finds out all cells covering with this named range.
This method will introduce a VBA macro to find out all cells which use the certain named range in Excel. Please do as follows:
1. Press the Alt + F11 keys simultaneously to open the Microsoft Visual Basic for Applications window.
2. Click the Insert > Module, and copy and paste following code into the opening Module window.
VBA: Find where a certain named range is used
3. Click the Run button or press F5 Key to run this VBA.
Sub Find_namedrange_place() Dim xRg As Range Dim xCell As Range Dim xSht As Worksheet Dim xFoundAt As String Dim xAddress As String Dim xShName As String Dim xSearchName As String On Error Resume Next xShName = Application.InputBox("Please type a sheet name you will find cells in:", "Kutools for Excel", Application.ActiveSheet.Name) Set xSht = Application.Worksheets(xShName) Set xRg = xSht.Cells.SpecialCells(xlCellTypeFormulas) On Error GoTo 0 If Not xRg Is Nothing Then xSearchName = Application.InputBox("Please type the name of named range:", "Kutools for Excel") Set xCell = xRg.Find(What:=xSearchName, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If Not xCell Is Nothing Then xAddress = xCell.Address If IsPresent(xCell.Formula, xSearchName) Then xFoundAt = xCell.Address End If Do Set xCell = xRg.FindNext(xCell) If Not xCell Is Nothing Then If xCell.Address = xAddress Then Exit Do If IsPresent(xCell.Formula, xSearchName) Then If xFoundAt = "" Then xFoundAt = xCell.Address Else xFoundAt = xFoundAt & ", " & xCell.Address End If End If Else Exit Do End If Loop End If If xFoundAt = "" Then MsgBox "The Named Range was not found", , "Kutools for Excel" Else MsgBox "The Named Range has been found these locations: " & xFoundAt, , "Kutools for Excel" End If On Error Resume Next xSht.Range(xFoundAt).Select End If End Sub Private Function IsPresent(sFormula As String, sName As String) As Boolean Dim xPos1 As Long Dim xPos2 As Long Dim xLen As Long Dim I As Long xLen = Len(sFormula) xPos2 = 1 Do xPos1 = InStr(xPos2, sFormula, sName) - 1 If xPos1 < 1 Then Exit Do IsPresent = IsVaildChar(sFormula, xPos1) xPos2 = xPos1 + Len(sName) + 1 If IsPresent Then If xPos2 <= xLen Then IsPresent = IsVaildChar(sFormula, xPos2) End If End If Loop End Function Private Function IsVaildChar(sFormula As String, Pos As Long) As Boolean Dim I As Long IsVaildChar = True For I = 65 To 90 If UCase(Mid(sFormula, Pos, 1)) = Chr(I) Then IsVaildChar = False Exit For End If Next I If IsVaildChar = True Then If UCase(Mid(sFormula, Pos, 1)) = Chr(34) Then IsVaildChar = False End If End If If IsVaildChar = True Then If UCase(Mid(sFormula, Pos, 1)) = Chr(95) Then IsVaildChar = False End If End If End Function
4. Now in the first opening Kutools for Excel dialog box please type the worksheet name into it and click the OK button; and then in the second opening dialog box please type the name of certain named range into it, and click the OK button. See screenshots:
5. Now the third Kutools for Excel dialog box comes out and lists cells using the certain named range as below screenshot shown.
After clicking the OK button to close this dialog box, these found cells are selected in the specified worksheet at once.
Note: This VBA can only look for cells using the certain named range in one worksheet at a time.
In you have Kutools for Excel installed, its Replace Range Names utility can help you find and list all cells and formulas which use the certain named range in Excel.
1. Click the Kutools > More > Replace Range Names to open the Replace Range Names dialog box.
2. In the opening Replace Range Names dialog box, go to Name tab, and click the Base Name drop down list and select the certain named range from it as below screenshot shown:
Now all cells and corresponding formulas which use the certain named range are listing in the dialog box at once.
3. Close the Replace Range Names dialog box.