If you want to change all spaces for underscores use:

=SUBSTITUTE(C8," ","_")

To remove multiple spaces at the start or end of your string, use:

=SUBSTITUTE(TRIM(C8)," ","_")
Answer from cybernetic.nomad on Stack Exchange
🌐
Quora
quora.com › How-do-you-insert-an-underscore-in-Excel
How to insert an underscore in Excel - Quora
Answer (1 of 2): The question is ambiguous. First possible answer is “Write it from the keyboard and close the cell” Second possible answer may understand the need of changing spaces and replace them by underscores in a selected area. This time you should use the dialog “Find and replace”, ...
Discussions

Need excel formula to insert underscore before the Proper case letter where ever find it in a string.
I need to replace a string like below: IpArId to be converted as Ip_Ar_Id Wherever the upper cases identified in a string to be prefixed with "underscore" ("_"). More on mrexcel.com
🌐 mrexcel.com
3
0
May 27, 2018
vba - "_" underscore in Excel Formula - Stack Overflow
I'm getting a problem, when I try to run these commands. Problem come from the formula expresion, since "_" is a syntax error, but I need exactly that formula in my Excel cells, How could I solve ... More on stackoverflow.com
🌐 stackoverflow.com
How to format a character ("_") in a cell value.
Hi, I am have dimensions in a column that have underscores ("_") in the cell value (ie: _5x10, _10_x_15). I would really like to hide the underscores in the column of data for all populated values. I don't believe this can be done with… More on answers.microsoft.com
🌐 answers.microsoft.com
10
2
November 25, 2019
excel - Trying understand what underscore means - Stack Overflow
Here is the sample code from a VBA function in an excel file. I am expecting the variables to be cell numbers, but have no inkling what the underscore means here. Can somebody explain to me what the & More on stackoverflow.com
🌐 stackoverflow.com
🌐
Reddit
reddit.com › r/excel › adding a leading underscore
r/excel on Reddit: Adding a leading underscore
February 2, 2023 -

I'm trying to make a dependent drop down list from a main list that is something like:

  • 1A

  • 1B

  • 2A

  • 2M

  • XYZ

  • Alpha

  • 7

  • 13

  • 21

I see that the named ranges that begin with numbers adds an underscore as the first character and that's screwing up my =INDIRECT() equation for the range of the dependent list. (It's working fine if I use a subset of just XYZ and Alpha)

How so I tell Excel to add a leading underscore? Everything I can google it talking about substituting an underscore in between things, and not adding a leading one.

🌐
Excel Forum
excelforum.com › excel-new-users-basics › 670293-add-underscore-in-between-letter-and-number.html
Thread: add underscore in between letter and number
You need to enter the formula in a cell adjacent to the top-most code... then copy that formula down by double-clicking the little black square at the bottom right corner of the cell with the formula in it. It should create the new code with the underscore in each cell below.
🌐
MrExcel
mrexcel.com › forums › question forums › excel questions
Need excel formula to insert underscore before the Proper case letter where ever find it in a string. | MrExcel Message Board
May 27, 2018 - 5. Enter the formula as shown in the screen shot below and copy down. 6. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm) ... Function Underscore(s As String) As String Static RX As Object If RX Is Nothing Then Set RX = CreateObject("VBScript.RegExp") RX.Global = True End If RX.Pattern = "([A-Z])" Underscore = s If RX.Test(s) Then Underscore = Left(s, 1) & RX.Replace(Mid(s, 2), "_$1") End Function
🌐
YouTube
youtube.com › skills up academy
Skills Up Academy | How to add underscore | Excel Tips & Tricks | ExcelTutorial - YouTube
In this informative video by Skills Up Academy, we delve into one of the most overlooked yet essential skills in Excel—how to add an underscore. Whether you'...
Published: January 21, 2025
Views: 54
Find elsewhere
🌐
Excelcommand
excelcommand.com › excel-help › excel-how-to.php
Excel - Add Underscore In Between Letter And Number - I dont know... - Free Excel Help
I dont know very much about excel and have searched all over Google for half the day tired of wasting time. I have hundreds of columns that look like this 01A 01B 01C 01D 02A ect..... I need to add an underscore in between the letter and number like this 01_A 01_B ect......
🌐
YouTube
youtube.com › watch
Replace space with underscore in Excel - YouTube
The video offers a quick tutorial on how to replace space with underscore in Excel.
Published: June 12, 2022
🌐
YouTube
youtube.com › office expert
Add Underscore in Excel for Beginners | Step-by-Step Tutorial & Tips - YouTube
Welcome to our step-by-step tutorial on how to add underscores in Excel! Whether you're a beginner or just looking to enhance your skills, this video will gu...
Published: September 25, 2024
Views: 571
🌐
Avantix Learning
avantixlearning.ca › home › how to replace spaces in excel with underscores (_), dashes (-) or other values
How to Replace Spaces in Excel with Underscores (_), Dashes (-) or Other Values
April 13, 2022 - Check out our virtual classroom or in-person Excel courses > ... Select the range of cells containing text strings that include spaces you want to replace. Press Ctrl + H to display the Find and Replace dialog box. You can also click the Home tab in the Ribbon and select Replace in the Find & Select group. In the Find what box, type a space. In the Replace with box, type an underscore, dash, or other value.
🌐
Automate Excel
automateexcel.com › home › replace space with underscore in excel & google sheets
Replace Space With Underscore in Excel & Google Sheets - Automate Excel
February 27, 2023 - Select the range of cells where you want to replace spaces (B2:B7), and in the Menu, go to Edit > Find and replace (or use the keyboard shortcut CTRL + H). In the pop-up window, (1) enter space in the Find box and (2) underscore (_) in the Replace with box. The, (3) click Replace All and (4) Done. The result is the same as in Excel: All spaces in the selected range are converted to underscores.
🌐
Arab Psychology
scales.arabpsychology.com › home › replace space with underscore in excel
Replace Space With Underscore In Excel
November 18, 2025 - It is crucial not to include any leading or trailing spaces, as this could lead to unintended replacements. Conversely, in the Replace with field, input a single underscore character (_). Once both fields are correctly populated, clicking the Replace All button executes the command across the highlighted range. Excel will then provide a confirmation message indicating the total count of replacements made, thereby confirming the success of the data standardization process.
🌐
MyExcelOnline
myexcelonline.com › home › how to use the underscore symbol in excel
How to Use the Underscore Symbol in Excel | MyExcelOnline
June 16, 2025 - For example, in #,##0_);(#,##0), the underscore plus right parenthesis (_)) adds spacing to align positive and negative numbers visually. This is not the same as inserting an underscore into a label; it’s purely for layout. It’s a subtle yet powerful trick for creating professionally aligned tables. ... John Michaloudis is a former accountant and finance analyst at General Electric, a Microsoft MVP since 2020, an Amazon #1 bestselling author of 4 Microsoft Excel books and teacher of Microsoft Excel & Office over at his flagship MyExcelOnline Academy Online Course.
🌐
The Bricks
thebricks.com › home › resources › how to replace spaces with underscores in excel
How to Replace Spaces with Underscores in Excel - Bricks
February 12, 2025 - Alternatively, use the keyboard shortcut: Ctrl + H (or Cmd + H on a Mac). Enter Your Criteria: A dialog box will appear. In the "Find what:" field, press the spacebar once. Don't type the word "space," just a literal space character. In the "Replace with:" field, type an underscore ( _ )....
🌐
Statology
statology.org › home › how to replace space with underscore in excel
How to Replace Space with Underscore in Excel
August 17, 2023 - Then type Ctrl + H to bring up the Find and Replace feature in Excel. Then type a single space in the Find what box and type a single underscore in the Replace with box.
🌐
YouTube
youtube.com › watch
Auto Underlines in Excel
To learn more, please visit the YouTube Help Center: https://www.youtube.com/help
🌐
Stack Overflow
stackoverflow.com › questions › 76684987 › trying-understand-what-underscore-means
excel - Trying understand what underscore means - Stack Overflow
Using the named range in code will ensure you are referring to the named range and not a hard coded cell address. The code is referencing the named cell, drag the cell around and run the code. Sub Msg_MyNamedRange() T1 = Range("MyNamedRange") MsgBox T1 End Sub · If you wanted to name a cell T1, you can't because T1 already exists on the sheet, you can add the underscore.
🌐
Microsoft Support
support.microsoft.com › en-us › office › format-text-or-numbers-as-superscript-or-subscript-3649411b-adf4-483e-b0e8-7b844605da74
Format text or numbers as superscript or subscript | Microsoft Support
Select characters in a cell or cell range that you'd like to format. On the Home tab, in the Font group, select the Font Settings dialog box launcher. OR Press CTRL+1. Under Effects, check the Superscript or Subscript box, and click OK. ... Although Excel doesn't have quick keyboard shortcuts ...