Excel merging two rows into one - excel

May I know how to merge two data into one cell?
For example:
A1 - 100100
A2 - 110000
into
A3 - 100100
110000

Just concatenate them as you normally would, and a line feed (char(10)) in the middle:
=A1 & CHAR(10) & B1
Make sure that "Wrap text" is set for cell A3.

or alternately:
=CONCATENATE(A1; CHAR(10);A2)
you'll still need the Wrap text enabled.
good page to learn more about excel functionality like this
http://www.excelfunctions.net/excel-string-concatenation.html

Related

TRANSPOSE() function wrongly adding semicolon between cell values

In Excel, I'm combining large lists using TRANSPOSE then CONCATENATE. My lists are >400 names and not always organized by column.
When I hit "F9" Excel has started adding a ";" between all of my values instead of "," thereby breaking the function. Has anyone else seen this? Know how to fix this? If I manually replace the semicolon, it works again.
Example data:enter image description here
If the names are vertical/organized by column
=TRANSPOSE(A1:A12)&", "
The functional output is
={"John, ","Tom, ","Mary, ","Jackson, ","Rob, ","Gerry, ","Heidi, ","Sheila, ","Alison, ","Wendy, ","Laura, ","Marion, "}
If the names are horizontal/organized by row
=TRANSPOSE(A1:L1)&", "
The non-functional output is
={"John, ";"Tom, ";"Mary, ";"Jackson, ";"Rob, ";"Gerry, ";"Heidi, ";"Sheila, ";"Alison, ";"Wendy, ";"Laura, ";"Marion, "}
If the names are vertical (A1:A12). Put
A2 =A1&","
A3 =A2&B3
and drag both until L3. A3 is your result.
If the names are horizontal (A1:L1), put
B1 =A1&", "
C1 =B1&C2
and drag both until C12. C1 is your result.
Hope that solves. (:

Basic Excel: How to show an interval in a cell rather than a single number

I want to make a column that lists a +or- 5%variance of a certain calculation.
For example, in column A and B there are a list of numbers and I want column C to show ColumA/ColumnB + or - 5%.
So if A1 = 10 and B1 = 12 then I want C1 to show ".792 to .875" or something like ".792 - .875" or "(.792,.875)".
In order to make it easy to look at, maybe I want a certain format that would change the colors of the 95% # and the 105% number ...
What would one do in these kind of situation?
You can use CONCATENATE, something like this:
=CONCATENATE(ROUND(A1/B1-(A1/B1*0.05),3)," - ",ROUND(A1/B1+(A1/B1*0.05),3))
As far as I know there is no way to have multiple formats in one cell containing a formula. It might be posible with VBA.
To get what your looking for you could use the text function.
You will have to generate the text with a formula, something like
="(" & text(c1,".000") & " - " & text(d1,".000") & ")"
Where c1 and d1 are the ranges you wish to show.
To get it to format with colour you can use conditional formatting on c1 and d1 to colour the cell where your formula is.
SincereApathy's answer doesn't work for me. Based on his answer, but using in-line concatenation instead of the CONCATENATE function:
=ROUND((A1/B1-0,05);3) & " - " & ROUND((A1/B1+0,05);3)

Referencing a cell to have a line change

In excel, it is possible to force a line change in the cell by pressing alt+enter when typing. Say I have cell A1 with "abc" on the top and "def" on the next line.
I want to write "=A1" in the cell A2 so that it displays the same thing. Unfortunately, they get concatenated, and in A2 it is simply written abcdef.
Does anyone know if it is even possible to do?
writing
="abc" & vbLF & "def"
does not work. Neither does chr(10). I can do it with vba but I would rather have a simple reference.
A copy/paste of A1 does not work either, as it splits the text between the cells underneath it. (A2 contains "abc", and A3 contains "def")
If you select the cell with the formula and hit "Wrap Text" the line breaks will appear as they were in the referenced cell.
For those that don't know where wrap text is at it is under the "Home" Tab in the "Alignment" category: (for excel 2010)

How can I concat cellvalues with new line in MS Excel?

In excel I can introduce a new line inside a cell with a [alt enter]
Boo[alt enter]Far
results in:
Boo
Far
Now A1 contains Boo, A2 contains Far. How can I display these values in A3 separated with a new line?
A3=A1[alt enter]&B1
results in BooFar
A3=A1&[alt enter]B1
results in BooFar
How can I get
Boo
Far
By using cell references?
In A3 enter:
=A1 & CHAR(10) & A2
and format A3 for wrap text
If it helps anyone using Office on Mac, you should use CHAR(13) for line breaks.
For the above example, that would be
=CONCATENATE(A1, CHAR(13), A2)
And of course, format for wrap text.
The 10 and 13 represent Line Feed & Carriage Return characters.

How to concatenate strings from hundreds of cells?

I am trying to combine sentences from various cells into one cell. Example:
A1 - "hello"
A2 - "how are"
A3 - "you"
A4 - =combine(A1:A3) ---- > "hello how are you"
I know this trick: =A1 & " " & A2..... but I have 700 cells to combine into a single cell and this approach seems barbaric. If there is a built in function, that would be ideal. I don't mind an answer in VBA as long as the answer is extremely detailed starting with how to open VBA, as I do not know VBA.
There is but it isn't much better: concatenate.
In your case, that would be concatenate(A1;" ";A2;" ";A3).
Neither are good ways to deal with 700 cells.
A VBA solution would be better. To open the VBA editor, press ALT+F11 (for a graphical explanation, see this article).
Afterwards, go to the "Insert" menu on top and select "Module". The editor will then be ready to accept input. Just paste the following (delete any other text that it may have):
Option Explicit
Public Function MyConcatenate(ByVal myRange As Range)
Dim vCell, vResult As String
For Each vCell In myRange.Cells
vResult = vResult & " " & vCell.Text
Next
MyConcatenate = Mid(vResult, 2)
End Function
You can now close the editor and return to the workbook.
To use it, write the following in a cell: =MyConcatenate(A1:A3).
You can use the StringConcat function found in this page: http://www.cpearson.com/excel/stringconcatenation.aspx
Then you can use it like this:
=StringConcat("|",B1:B5)
An you will received all values from the range: B1:B5 separated by |.
In case the link is broken, you can find the source of the function here: http://pastebin.com/JNS9pYWA.
For a relatively modest 700 cells formulae would seem viable.
in B1: =A1&" "
in C1: =B1
in B2: copy B1 (ie =A2&" ")
in C2: =C1&B2
then copy down B2:C2 as required.
I too have the same problem. I have data in column A from A1:A980.
But I have found out the solution as below.
In B2 I put the formula as =CONCATENATE(B1," ",A1," ",A2)
and from B3 I entered formula as =CONCATENATE(B2," ",A3) and in B3 as =CONCATENATE(B3," ",A4) till B980.
This will give you your result in last B90 cell and that too without any VBA.
Hope you might have the same problem then this might solve the issue.

Resources