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

Data Analysis

  • How to Create Thermometer Chart in Excel
  • Excel Line Chart
  • Subtotal function in Excel
  • Create Scatter Chart in Excel
  • Calculate Conditional Percentile ‘IF’ in table in Excel

References

  • Approximate match with multiple criteria in Excel
  • Find Closest Match in Excel Using INDEX, MATCH, ABS and MIN functions
  • How to get last row in text data in Excel
  • Excel Advanced Lookup using Index and Match Functions
  • How to use Excel FORMULATEXT function

Data Validations

  • Prevent invalid data entering in specific cells
  • Excel Data validation no punctuation
  • Excel Data validation with conditional list
  • Excel Data validation must begin with
  • Excel Data validation don’t exceed total

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 XOR Function
  • SWITCH function: Description, Usage, Syntax, Examples and Explanation
  • FALSE function: Description, Usage, Syntax, Examples and Explanation
  • SWITCH function example in Excel
  • Not Equal To ‘<>‘ operator in Excel

Date Time

  • Get project midpoint in Excel
  • Get days, months, and years between dates in Excel
  • Get first Monday before any date in Excel
  • Pad week numbers with zeros in Excel
  • Excel Date & Time Functions Example

Grouping

  • How to randomly assign people to groups in Excel
  • Map text to numbers in Excel
  • Group numbers at uneven intervals in Excel
  • Map inputs to arbitrary values in Excel
  • Calculate conditional mode with criteria in Excel

General

  • Subtotal by invoice number in Excel
  • How to count total columns in range in Excel
  • Cell References: Relative, Absolute and Mixed Referencing Examples
  • Count cells less than in Excel
  • How to choose page/paper size in Excel before Printing
© 2026 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning