Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • Working With Tables in Excel
  • Calculate Conditional Percentile ‘IF’ in table in Excel
  • How to sum a total in multiple Excel tables
  • How To Sort One Column or Multiple Columns in Excel
  • Managing Conditional Formatting Rules in Excel

References

  • How to use Excel INDIRECT Function
  • How to get last column number in range in Excel
  • How to get address of named range in Excel
  • To count total rows in a range in Excel
  • How to get first column number in range in Excel

Data Validations

  • Excel Data validation with conditional list
  • Excel Data validation require unique number
  • Excel Data validation must contain specific text
  • Excel Data validation allow weekday only
  • How To Create Drop-down List in Excel

How to Remove Leading Spaces in Excel

by

The TRIM function in Excel removes leading spaces, extra spaces and trailing spaces. Use the SUBSTITUTE function to remove all spaces or non-breaking spaces.

1. The TRIM function below removes 2 leading spaces, 3 extra spaces and 2 trailing spaces.

Note: the TRIM function does not remove single spaces between words.

2. To get the length of a string, use the LEN function.

Explanation: the LEN function counts 2 spaces, 2 characters, 4 spaces, 3 characters and 2 spaces.

Worked Example:   Extract word that begins with specific character in Excel

3. You can use the SUBSTITUTE function to remove all spaces.

Note: the SUBSTITUTE function substitutes spaces (second argument) with empty strings (third argument).

Text imported from other applications may contain ASCII characters. The CLEAN function removes the first 32 non-printable ASCII characters (codes 0 through 31).

4. The CLEAN function below removes a non-printable character, CHAR(7).

5. Simply combine the CLEAN and the TRIM function to remove non-printable characters and spaces.

Worked Example:   Extract last name from full name -- Manipulating NAMES in Excel

6. The CLEAN function removes line breaks. To enter a line break, press ALT + ENTER.

7. You can also use the SUBSTITUTE function to remove a line break, CHAR(10), and replace it with something else. For example, a comma and a space.

The CLEAN function doesn’t remove all ASCII characters. Simply use the SUBSTITUTE function to remove other ASCII characters.

Worked Example:   How to get last word in a cell in Excel

8. First, find out the code number of the character.

9. Next, use the SUBSTITUTE and the CHAR function to return the text string without this character.

10. If your text contains non-breaking spaces, CHAR(160), the TRIM function doesn’t work.

11. You can use the SUBSTITUTE function to substitute non-breaking spaces, CHAR(160) with normal spaces, CHAR(32). Don’t forget to add a TRIM function to remove the extra spaces.

Post navigation

Previous Post:

Complete List of Excel Cube Functions References and Examples

Next Post:

Excel Bar Chart

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • NOT function: Description, Usage, Syntax, Examples and Explanation
  • IF with boolean logic in Excel
  • Invoice status with nested if in Excel
  • How to use Excel TRUE Function
  • XOR function: Description, Usage, Syntax, Examples and Explanation

Date Time

  • Excel Date & Time Functions Example
  • Get project midpoint in Excel
  • Calculate total hours that fall between two times in Excel
  • Display Days in month in Excel
  • NOW function: Description, Usage, Syntax, Examples and Explanation

Grouping

  • Group arbitrary text values in Excel
  • Group times into unequal buckets in Excel
  • Group times into 3 hour buckets in Excel
  • How to randomly assign data to groups in Excel
  • Running count group by n size in Excel

General

  • How to Insert Cells, Row and Rows in Excel
  • Count cells that do not contain many strings in Excel
  • How to count total number of cells in a rectangular range in Excel
  • Check if multiple cells have same value in Excel
  • How to Delete Cells, Row and Rows in Excel
© 2023 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning