Excel Tutorials · Lesson 69

How to Make a Search Bar in Excel

Ctrl+F cycles through matches one at a time and disappears the moment you close the dialog. A real search bar lives on the sheet, filters or highlights matches as you go, and can be reused by anyone who opens the file. This lesson covers turning on the Developer tab, wiring up the macro, and a no-code alternative for anyone on Excel 365.

Return to Class

Download the Free Excel Xpert Workbook

The same free Excel Xpert companion workbook used in the video, one tab per lesson. No login, no email required.

⬇ Excel Xpert Workbook (.xlsx)

What a Search Bar in Excel Actually Is

A search bar is a small piece of interface built directly into the sheet: a place to type a term, and a mechanism, usually a macro, that reacts by highlighting, jumping to, or filtering down to the rows that match. It replaces the built-in Ctrl+F dialog, which finds one match at a time and closes the moment you click away from it.

Building one requires the Developer tab, which is not on the ribbon by default because most people never touch macros or form controls. Turning it on takes one trip through Excel's options, and once it is on it stays on for every workbook going forward, not just this one.

From there, a search bar is really two pieces working together: a cell or Form Control text box holding whatever the user types, and a macro, formula, or filter that reacts to it. The macro route (what this lesson covers) works in every version of Excel and can do more, like jumping the screen to the matching row. The formula route, using FILTER, needs Excel 365 or 2021+ but requires no code at all.

The honest framing: a search bar is a convenience layer, not a replacement for good data structure. If a sheet is small, Ctrl+F is often genuinely faster. It earns its place once a sheet is large enough, or shared with people who aren't comfortable with Excel's native find dialog.

How to Make a Search Bar in Excel

Step-by-step, matching the video above.

1

Turn on the Developer tab

Go to File > Options > Customize Ribbon, check the Developer box in the right-hand list, and click OK. It is off by default, and every step after this needs it.

2

Insert a text box for the search term

On the Developer tab, use Insert > Form Controls, or simply set aside a plain cell, to hold whatever the user types in.

3

Open the VBA editor

Click Visual Basic on the Developer tab, or press Alt+F11, then right-click the workbook and insert a new module.

4

Write the search macro

Use Range.AutoFilter to filter the table to matching rows, or a Cells.Find loop to jump the screen to the first match and highlight it.

5

Assign the macro to a button

Insert a Form Control button next to the search box, right-click it, choose Assign Macro, and select the macro you wrote.

6

Handle no matches

Wrap the search in an error check so an unmatched term shows a clear message, like "No results found," instead of a runtime error or a blank screen.

7

Save as a macro-enabled workbook

Save the file as .xlsm. Saving as a regular .xlsx silently strips the macro out, and the search button stops doing anything.

Worked Example: A Filter-Based Macro
PieceWhat it holdsPurpose
B1Search cell (user types here)Input
ButtonRuns the SearchTable macroTrigger
A3:D200The table being searchedData

The macro reads B1, applies an AutoFilter to column A using "*" & Range("B1").Value & "*" as the criteria, and the wildcards on each side make it a partial, case-insensitive match. Clearing B1 and re-running the macro removes the filter and shows every row again.

The Two Approaches Explained

A macro search bar and a formula search bar solve the same problem two different ways.

The macro approach — AutoFilter or Find

Works in every version of Excel back to 2007. AutoFilter narrows the visible rows to matches; Cells.Find instead jumps the screen and selects the first matching cell without hiding anything.

The formula approach — FILTER, no macro

=FILTER(A3:D200,ISNUMBER(SEARCH(B1,A3:A200))) spills every matching row live as B1 changes. Requires Excel 365 or 2021+, but needs no Developer tab, no VBA, and survives being copied into any workbook.

SEARCH vs FIND inside the formula

SEARCH ignores case and supports wildcards, which is what you want for a search box. FIND is case-sensitive and has no wildcard support, useful only when exact casing matters.

Searching more than one column

Combine checks with OR: ISNUMBER(SEARCH(B1,A3:A200))+ISNUMBER(SEARCH(B1,B3:B200))>0 inside FILTER matches a term appearing in either column.

Adding a Clear button

A second, one-line macro that runs Range("B1").ClearContents and removes any active AutoFilter resets the view instantly without touching the data underneath.

Working With the Developer Tab

Everything in this lesson lives behind one setting.

Why it's hidden by default

The Developer tab exposes macros, form controls and add-ins, tools most spreadsheet users never touch, so Microsoft keeps it off the ribbon until you turn it on.

Turning it on

File > Options > Customize Ribbon, check the Developer box on the right, click OK. It is a one-time setting per computer, not per workbook.

What lives on it that you'll use

Insert (for Form Control buttons and text boxes), Macros (to record or run one), and Visual Basic (to write or edit the code by hand).

Macro security when sharing the file

Recipients see a yellow security bar and must click Enable Content before the search button will do anything. This is a Windows-level protection, not a bug in the file.

Worked Example: The Same Search Two Ways
MethodNeeds Developer TabWorks On
AutoFilter MacroYesExcel 2007 and later
FILTER FormulaNoExcel 365, 2021+, Google Sheets

Neither is strictly better. The macro version can do more (jump the screen, change colors, log searches), while the formula version is simpler to build, easier to share safely, and needs no macro security prompt at all.

Fixing Common Search Bar Problems

Four things that go wrong on the first attempt.

The button does nothing

Either the macro wasn't assigned to it (right-click > Assign Macro), or the file was saved as .xlsx and the macro was silently removed.

The search only matches exact text

Missing wildcards. Wrap the criteria in "*" & value & "*" for AutoFilter, or use SEARCH rather than an exact equals comparison in a formula.

Runtime error on an empty search box

Add a check at the top of the macro that exits immediately, or shows every row, when the search cell is blank, instead of letting Find or AutoFilter run on nothing.

Filter never clears

AutoFilter stays applied until something explicitly removes it. Build the Clear button early, not as an afterthought, or testing gets confusing fast.

Practical Uses and the Google Sheets Version

Where a search bar earns its place over Ctrl+F.

Large customer or inventory lists

Once a sheet runs into thousands of rows, a search box that filters down instantly beats scrolling or repeatedly opening Ctrl+F.

Shared workbooks used by non-Excel-experts

A visible search box and button is more discoverable than a keyboard shortcut for anyone unfamiliar with Excel, especially on a shared team file.

Building it in Google Sheets

Sheets has no VBA, but the FILTER formula version works identically, since FILTER is native to Sheets and does not depend on Apps Script or macros.

Combining a search bar with a form

A search bar for finding existing records pairs naturally with a data entry form for adding new ones, so a table can be searched and maintained from the same sheet.

Common Search Bar Mistakes to Avoid

⚠️

Saving as .xlsx instead of .xlsm

Excel silently strips macros when you save as a regular workbook. If the button stops working after a save, this is the first thing to check.

⚠️

Forgetting the wildcard characters

Without * on each side of the search value, only an exact, whole-cell match is found, which feels broken to anyone typing a partial term.

⚠️

Not handling an empty search box

Running Find or AutoFilter against a blank value either throws an error or filters everything out. Add a check that shows all rows when the box is empty.

⚠️

Hard-coding the search range

A fixed range like A3:A200 stops matching new rows once the table grows past it. Reference an Excel Table instead so the range expands automatically.

⚠️

No way to clear the search

Without a Clear button, an active AutoFilter stays applied indefinitely, and anyone reopening the file later sees a partial view with no obvious reason why.

⚠️

Assuming everyone will click "Enable Content"

Recipients who don't trust the file, or don't recognize the prompt, will leave macros disabled and the search bar simply won't respond. Say so plainly if you send the file out.

Beyond the Spreadsheet

You Just Wrote a Macro to Find a Row.Updoot Search Is Already There.

Finding something shouldn't require the Developer tab.

🔍
You search for
A row in a growing spreadsheet
Doot's Desk
Everything is already searchable in one place
👤
You search for
An employee's role or contact info
Org Chart
Instant search across every person and role
📄
You search for
An SOP buried in a shared drive
SOPs
Every process is indexed and searchable

Free 14-day trial. No credit card required.

Frequently Asked Questions

What is a search bar in Excel?

A text box on the sheet that jumps to, highlights, or filters matching rows as you type or click Search, instead of the pop-up Ctrl+F dialog that only cycles through matches one at a time.

How do I turn on the Developer tab?

Go to File > Options > Customize Ribbon, check the Developer box in the right-hand list, then click OK. The Developer tab now appears on the ribbon with Insert, Macros and Visual Basic.

Why do I need the Developer tab for a search bar?

The Developer tab is where you insert the Form Control text box and button, and where you open the VBA editor to write the macro that actually performs the search.

Do I have to save the file as .xlsm?

Yes. Any workbook containing a macro must be saved as an Excel Macro-Enabled Workbook (.xlsm), or the macro is stripped out when you save as a regular .xlsx.

Can I build a search bar without VBA?

Yes, in Excel 365 or Excel 2021 and later, a single FILTER formula referencing a search cell shows only the matching rows live, with no macro required.

How do I search across more than one column?

Wrap each column in its own SEARCH check and combine them with OR inside the FILTER formula, or loop through each column in the macro version.

Is the search case sensitive?

Not by default. Both the SEARCH function and Excel's Find method ignore case, which is almost always what you want in a search bar. Use FIND instead of SEARCH if you need case sensitivity.

Does the search bar find partial matches?

Yes, by default. Wildcards are implied, so typing part of a name or word matches any cell containing that text anywhere within it.

What happens if nothing matches the search?

A well-built search bar should show a message like No Results Found instead of an error or a blank screen, handled with an IFERROR wrapper or an On Error line in the macro.

Can I add a Clear button to reset the search?

Yes. Assign a second macro to a button that clears the search cell and re-shows all rows, or clears the FILTER formula's input cell.

Does this work in Google Sheets?

Yes. Google Sheets has no VBA, but the same FILTER-based, no-code version works identically, since FILTER exists natively in Sheets.

Why did my search bar stop working after I sent the file to someone else?

Their macro security settings likely blocked it. Macros are disabled by default on files from outside sources, so recipients need to click Enable Content in the yellow security bar.

Ready to stop hunting for numbers across a grid?

Every business starts with a spreadsheet. Updoot is where you scale past it, with data already connected to where it belongs.

Start Your Free Trial →