Kirk has a formula that concatenates text values: =A1 & A2 & A3. He is looking for a way to simulate the pressing of Alt+Enter between each of the concatenated values. There are two ways that this can be approached, and both end up with the same results.
The first method is to simply press Alt+Enter between the values as you are entering the formula. For instance, consider the following formula:
=A1 & "[ae]" & A2 & "[ae]" & A3
In this instance, every place that you see [ae] you would actually press Alt+Enter. Thus, you would end up with a formula that looked like this just before entering it:
=A1 & " " & A2 & " " & A3
If you find entering this type of formula distracting, you can always use the actual character code that Excel does whenever you press Alt+Enter. The following formula shows this approach:
=A1 & CHAR(10) & A2 & CHAR(10) & A3
The CHAR(10) inserts a line feed character, which is the same as is done by Excel when you press Alt+Enter.
If, after entering your formula, you don't see the results on separate lines, it is because you don't have wrapping turned on for the cell. Instead you'll see a small square box where the line feed character is located. To see the results of the formula on separate lines, display the Format Cells dialog box (click Format | Cells). On the Alignment tab select the Wrap Text check box.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2788) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Simulating Alt+Enter in a Formula.
Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!
You can easily set up a formula to perform some calculation on a range of cells. When you copy that formula, the copied ...
Discover MoreNeed to sum a series of cells that fits some regular pattern? Here are several ways that you can get the summation that ...
Discover MoreExcel is very good at counting things, even when those things need to meet specific criteria. This tip shows how you can ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2022-03-20 07:25:19
Jean baptiste
Nice and usefull
2021-10-01 16:29:58
Rene P Danos
Hey Allen,
I have a macro that uses this line of code >ActiveCell.FormulaR1C1 = _
"1.let's test the following: " & Chr(10) & "a.red" & Chr(10) & "b.green" & Chr(10) & "c.blue" & Chr(10) & "2.if they exist" & Chr(10) & "c.pick red" & Chr(10) & "d.leave green" & Chr(10) & "e.discard blue"<
I am trying to make it work the same way but not be specific about what is after 1. a. b. c. 2. d. and e. I tried the below but it only list the 1. a. b. c. 2. d. and e. but not the words > ActiveCell.FormulaR1C1 = _
"1. " & Chr(10) & "a." & Chr(10) & "b." & Chr(10) & "c." & Chr(10) & "2." & Chr(10) & "c." & Chr(10) & "d." & Chr(10) & "e." <
2021-10-01 06:09:55
zulkey
Thank you :)
2019-02-08 15:03:22
Erik Andersson
Every day I learn something! Thanks for this!
2018-08-15 05:21:34
labrys
When using char(10) or char(13) in formula for text value of a shape however, it makes a big space (like a <P> instead of <BR> in html) - as opposed to when manually typing it into the shape.
Is there a way in the formula to remove this extra space. It tried converting it into a CRLF (char(13)&char(10)) but this just makes two big spaces . char(10) or char(13) just make a big paragraph essentially. I can’t make a shape dynamic with CR's in it, and still look the same as static text with enters pressed.
2017-09-11 05:34:14
Oscar
how to Simulating Alt+Enter in vlookup formula
2017-01-13 09:39:53
celia
Hi Allen,
thank you for this information.
It saved me so much time.
C
2017-01-11 10:48:55
I'm using a slim keyboard and there is not a left ALT, only right ALT. And in Excel left ALT + ENTER dont work.
How can I break line without left ALT?
2016-10-20 20:39:14
T Le
Thank you very much for this Simulating Alt+Enter in a Formula.
2015-11-10 02:02:42
Toeiii
Really useful! Thanks :)
2015-10-19 15:06:40
rohit
I have string value in cell with two line.
I want to color the value after 1st line.
Active
Alert
Discharge
Second two line should be red color.
2015-10-04 10:17:42
Srinath
Hi friends.. i have a problem in counting Total of few numbers which enterd in one single cell using Alt+Enter. now i need total of those numbers.. please help me..
2015-09-09 07:42:56
chaya kanojia
its amazing ... i want to high knowledge of excel .. can you help ?????????
2015-07-09 02:58:14
Jan
Thanks, working perfekt
2015-04-23 13:46:47
Clinton
Awesome! Thank you!
2015-03-04 09:16:52
lucio
no Excel 2013, a fórmula é
= A1 & Caract(10) & A2 & Caract(10) & A3
2015-01-22 14:13:34
Ok, so am using the Alt + Enter, but am having a unique problem, when I change the second line font color from black to any color, it changes the font size from 10 to 7. Any ideas? No conditional formatting is being used on the cells, FYI
2014-06-04 19:25:00
boobalan
yes, i agree the function is CHR() not CHAR()
2014-04-11 03:17:04
Ben Wit
The name of the worksheetfunction you would use depends on the installed language of thhe office version, and is CHAR() for English.
In VBA thhe function,not depending on installed language, CHR()
2014-04-09 13:44:41
Scott
Thanks, Micky
2014-04-08 07:12:17
Michael (Micky) Avidan
@Scott,
The result of your believe is wrong.
CHAR is used in sheet formulas, whereas CHR is used in VBA.
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2014)
ISRAEL
2014-04-07 10:51:51
Scott
I believe that the function is called CHR() not CHAR().
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2022 Sharon Parq Associates, Inc.
Comments