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

Data Analysis

  • Understanding Anova in Excel
  • Chart Axes in Excel
  • How to calculate average last N values in a table in Excel
  • How To Perform and Interpret Regression Analysis in Excel
  • Example of COUNTIFS with variable table column in Excel

References

  • How to get address of first cell in range in Excel
  • Convert text string to valid reference in Excel using Indirect function
  • How to use Excel TRANSPOSE Function
  • How to get address of last cell in range in Excel
  • Extract data with helper column in Excel

Data Validations

  • Excel Data validation whole percentage only
  • Excel Data validation require unique number
  • Excel Data validation specific characters only
  • Excel Data validation number multiple 100
  • Excel Data validation date in specific year

Remove line breaks in a cell in Excel

by

To remove line breaks from a cell, or from text inside a formula, you can use a formula based on the SUBSTITUTE and CHAR functions.

Formula

=SUBSTITUTE(A1,CHAR(10),", ")

Explanation

In the example shown, the formula in C5 is:

=SUBSTITUTE(B5,CHAR(10),", ")

which replaces line breaks in B5 with commas.

How this formula works

First, you should know that Excel contains two functions, CLEAN and TRIM, that can automatically remove line breaks and extra spaces from text. For example to strip all line breaks from a cell, you could use:

=CLEAN(B5)

In this case, however, we are removing line breaks and replacing them with commas, so we are using the SUBSTITUTE function instead of CLEAN. SUBSTITUTE can locate matching text anywhere in a cell, and replace it with the text of your choice. SUBSTITUTE can accept up to four arguments, but we are using only the first three like this:

=SUBSTITUTE(B5,CHAR(10),", ")

The text comes from cell B5.

The “old text” is entered as CHAR(10). This will match the line break character used in Windows.

The “new text” is entered as “, “. This translates to a comma plus one space. We need the quotes because this is a text value.

SUBSTITUTE then replaces all line breaks in the cell with commas and returns the final result as text in C5. Because “old text” is an argument, you can change the comma to any other text you like.

Post navigation

Next Post:

Create One-dimensional and Two-dimensional Array

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

  • XOR function: Description, Usage, Syntax, Examples and Explanation
  • IF with wildcards in Excel
  • OR function Examples in Excel
  • How to use Excel FALSE Function
  • IFNA function: Description, Usage, Syntax, Examples and Explanation

Date Time

  • Dynamic date list in Excel
  • Convert text to date in Excel
  • Generate series of dates by weekends in Excel
  • Sum race time splits in Excel
  • Get date from day number in Excel

Grouping

  • Group times into unequal buckets in Excel
  • How to randomly assign data to groups in Excel
  • Group arbitrary text values in Excel
  • Categorize text with keywords in Excel
  • Calculate conditional mode with criteria in Excel

General

  • Count cells that do not contain many strings in Excel
  • How to calculate percentage discount in Excel
  • How to get original number from percent change in Excel
  • How to Delete Cells, Row and Rows in Excel
  • How to calculate percentage of total in Excel
© 2025 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning