Summary

To add a line break taking into account the current OS (Mac or Windows), you can use the INFO function to test the system and then return the correct break character — ASCII 10 for Windows and ASCII 13 on a Mac. In the worksheet shown, the formula in cell C3 is:

=IF(INFO("system")="mac",CHAR(13),CHAR(10))

Notice that cell C3 has been named "break" as you can see in the name box. The result is that the name break can be used like a variable in other formulas.

This formula will not work correctly and is not needed in current versions of Mac Excel. Starting with Excel 2016, the Mac version of Excel began to use ASCII 10 as a line break character, the same as the Windows version. The example on this page is therefore historical to illustrate how the INFO function can be used to switch a value depending on the platform Excel is running on. See: How to insert a line break with a formula for a standard formula solution in current versions of Excel.

Generic formula

=IF(INFO("system")="mac",CHAR(13),CHAR(10))

Explanation 

In older versions of Excel (before Excel 2016?), the character used for line breaks is different depending on whether Excel is running on a Mac or Windows computer: On Windows Excel, the line break character is ASCII 10. In older versions of Excel on a Mac, the line break character is ASCII 13. These are invisible characters and therefore difficult to enter directly into a formula. The standard way to insert them in a formula is to use the CHAR function like this:

CHAR(10) // line break in Win Excel
CHAR(13) // line break in Mac Excel

Because the line break varies by platform in older versions of Excel, it is tricky to write a single formula that will work as expected on both platforms. One solution is to use the INFO function to test the current environment and then set a value for a line break that is conditional on the platform. In the worksheet shown, we do this by first naming cell C3 "break". Then, in the same cell, we enter the following formula:

=IF(INFO("system")="mac",CHAR(13),CHAR(10))

Now we can use the word break like a variable in a formula. If Excel is running on a Mac, break will equal CHAR(13), if not, break will equal CHAR(10). In column E, we can then concatenate the address information that appears in B, C, and D with a formula like this:

=B6&break&C6&break&D6

The result of the concatenation is text with line breaks:

Traci Brown¬
1301 Robinson Court¬
Saginaw, MI 48607

Note: to see the line break take effect, you will need to enable text wrap.

Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi - I'm Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.