Find and Replace Tab Character in Excel (2 Suitable Ways)

We have 5 cells that have the tab character inside. We want to find and replace these tab characters.

Inputs with Tab Character


Method 1 – Using the Find and Replace Dialogue Box

Steps:

  • Create a new column named Output to get your result.
  • Select the inputs (B5:B9) and right-click.
  • Choose the option Copy from the context menu.

Copy the Inputs to Find and Replace Tab Character in Excel

  • Select the C5 cell and right-click.
  • Choose the Paste option from the context menu.

Paste the Copied Cells

  • Select the output cells (C5:C9) and go to Home tab and the Editing group.
  • Choose the Find & Select tool and the Replace… option.

Choose Replace Option to Find and Replace Tab Character in Excel

  • The Find and Replace dialogue box will appear.
  • Go to the Replace tab and type Alt + 0009 in the Find what: text box.
  • Put a space in the Replace with: text box.
  • Click on the Replace All button.

Find and Replace a Tab character with Spacebar in Excel

  • You will see that all the tab characters are found and replaced with a spacebar. For our example, the output should look like this.

Output without Tab Characters

Note:

Alt + 0009 is the tab character. You need to use the leading zeroes.

Read More: Find And Replace Multiple Values in Excel


Method 2 – Utilizing a Text Editor to Find and Replace the Tab Character

Steps:

  • Copy the inputs (B5:B9) containing tab characters by right-clicking and selecting the Copy option from the context menu.

Copy Input Cells

  • Open a new text document on your PC.
  • Right-click inside the text editor and choose the Paste option from the context menu.

Paste the Copied Cells in Text Document to Find and Replace Tab Character in Excel

  • You will see that the inputs are inside the text editor now with tab characters.

Inputs with Tab Characters

  • Select the tab character from any input, right-click, and choose the Copy option from the context menu.

Copy Tab Character

  • Press Ctrl + H to open the Replace window.

Bring the Replace Window to Find and Replace Tab Character in Excel

  • Paste the selection inside the Find what: text box.
  • Put a space in the Replace with: text box.
  • Click on the Replace All button.

Find and Replace Tab Character in Excel

  • All the tab characters will be found and replaced by a space in the text editor.

Text Document without Tab Characters

  • Select all the lines from the text editor and right-click.
  • Choose the Copy option from the context menu.

Copy the Result from Text Editor

  • Go to the Excel file and right-click on cell C5.
  • Choose the Paste option from the context menu.

Paste the Lines in the Output Column

  • This pastes the new values without the tab character.

Output with No Tab Characters


How to Replace or Remove Tab Characters in Excel

Method 1 – Combine TRIM, SUBSTITUTE, and CHAR Functions to Replace the Tab Character

Steps:

  • Click on C5 and insert the following formula:
=TRIM(SUBSTITUTE(B5,CHAR(9),""))

Combine the SUBSTITUTION, TRIM, CHAR Functions to FInd and Replace Tab Character in Excel

  • Hit the Enter button.
  • Place your cursor in the bottom right position of the C5 cell. A black fill handle will appear.
  • Drag it down to copy the formula for all the cells.

Drag Fill Handle Below to Copy Same Formula

  • This will replace the tab character with a space in all cells.

Output without Tab Characters

Read More: How to Find and Replace Using Formula in Excel


Method 2 – Use the CLEAN Function

Steps:

  • Click on C5.
  • Insert the following formula and press Enter.
=CLEAN(B5)

Use the CLEAN Function to Remove Tab Character in Excel

  • Place your cursor in the bottom right corner of the C5 cell.
  • Drag the fill handle down.

Drag the Fill Handle Below

  • This fills in the column with the formula.

Outputs without Tab Characters


Method 3 – Apply VBA Code to Replace the Tab Character in Excel

Steps:

  • Go to the Developer tab and choose the Visual Basic tool.

Choose the Visual Basic Tool

  • The Microsoft Visual Basic for Applications window will appear.
  • Go to Sheet4 from the VBAProject list.
  • Copy the following code in the code window.
Sub RemoveTabCharacter()
    Selection.Replace Chr$(9), vbNullString
End Sub

Write Required Code to Find and Replace Tab Character in Excel

  • Close the Visual Basic window and go to the File tab from the main Excel ribbon.

Go to the File Tab

  • Choose the Save As option.

Choose the Save As option

  • Click on the Browse option.

Excel Save As Window

  • Choose the .xlsm type from the Save as type: options.
  • Click on the Save button.

Save the Excel file in .xlsm Format to Enable Macro

  • Select the cells C5:C9 and go to the Developer tab, then select Macros.

Choose the Macro Option

  • The Macros window will appear. Choose the Sheet4.RemoveTabCharacter macro and click on the Run button.

Run the Required Macro to Find and Replace Tab Character in Excel

  • All the tab characters will be replaced by a null string, and the result should look like this.

Outputs without Tab Characters


Method 4 – Use Excel Power Query

Steps:

  • Copy and paste the input lines into the Output column.
  • Select the C5:C9 cells.
  • Go to the Data tab and select From Table/Range.

Access to the Power Query Window to Find and Replace Tab Character in Excel

  • The Power Query window will appear. Right-click on the header and choose the Transform option.
  • Select the Clean option.

Choose the Clean Option to Find and Replace Tab Character in Excel

  • You will see the tab characters are cleaned now.

Power Query Window without Tab Characters

  • Close the Power Query window. The Power Query Editor window will appear.
  • Click on the Keep button.

Choose the Keep Option

  • You can see there is a new sheet containing your outputs without any tab character. The result should look like the following image:

Output without Tab Characters


Download the Practice Workbook


Related Articles


<< Go Back to Find and Replace | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Tanjim Reza
Tanjim Reza

Md. Tanjim Reza Tanim, a BUET graduate in Naval Architecture & Marine Engineering, contributed over one and a half years to the ExcelDemy project. As an Excel & VBA Content Developer, he authored 100+ articles and, as Team Leader, reviewed 150+ articles. Tanim, leading research, ensures top-notch content on MS Excel features, formulas, solutions, tips, and tricks. His expertise spans Microsoft Office Suites, Automating Finance Templates, VBA, Python, and Developing Excel Applications, showcasing a multifaceted commitment to the... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo