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

Data Analysis

  • How To Compare Two Lists in Excel
  • How To Sort One Column or Multiple Columns in Excel
  • How to calculate correlation coefficient Correlation in Excel
  • Move chart to a separate worksheet in Excel
  • Example of COUNTIFS with variable table column in Excel

References

  • Create hyperlink with VLOOKUP in Excel
  • Basic INDEX MATCH approximate in Excel
  • Lookup entire row in Excel
  • How to get last row in mixed data with blanks in Excel
  • Two-column Lookup in Excel

Data Validations

  • Excel Data validation only dates between
  • Excel Data validation allow weekday only
  • Excel Data validation whole percentage only
  • Excel Data validation date in next 30 days
  • Excel Data validation exists in list

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

  • How to use Excel AND Function
  • IFS function: Description, Usage, Syntax, Examples and Explanation
  • IF, AND, OR and NOT Functions Examples in Excel
  • How to return blank in place of #DIV/0! error in Excel
  • How to use Excel TRUE Function

Date Time

  • Get days before a date in Excel
  • How to calculate nth day of year in Excel
  • MINUTE function: Description, Usage, Syntax, Examples and Explanation
  • Get last working day in month in Excel
  • Create date range from two dates in Excel

Grouping

  • Group numbers at uneven intervals in Excel
  • Group numbers with VLOOKUP in Excel
  • Running count group by n size in Excel
  • If cell contains one of many things in Excel
  • Map text to numbers in Excel

General

  • AutoRecover file that was never saved in Excel
  • How to increase by percentage in Excel
  • How to get original number from percent change in Excel
  • How to get amount with percentage in Excel
  • How to calculate percentage discount in Excel
© 2025 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning