Over the last month we have seen some 52, Excel Tips, Tricks, Cheats & Hacks presented by some of the best Excel practitioners on the net:
Excel Tips, Tricks, Cheats & Hacks – Microsoft MVP Edition
Excel Tips, Tricks, Cheats & Hacks – Chandoo.org Excel Ninja Edition
Excel Tips, Tricks, Cheats & Hacks – Notable Excel Sites Edition
Excel Tips, Tricks, Cheats & Hacks – Readers Prequil
In this final post I am presenting a compilation of Readers Contributions.
These have been compiled from comments on the above 4 posts and submissions sent directly to me.
I hope you enjoy the following Excel Tips, Tricks, Cheats & Hacks – Readers Edition
001. Toggle the Absolute/Relative $ Sign in Formulas using F4 – Desk Lamp
Instead of typing $AA$12 simply type AA12 then press F4.
Press F4 to Toggles through the sequence: AA12 -> $AA$12 -> AA$12 -> $AA12 -> AA12
You can read about Absolute vs Relative Cell References here
002. Current Region – Peter Carr
My favorite tip is the CurrentRegion of a range.
CurrentRegion is the contiguous range of cells starting from a cell, and moving out in all directions until an entire blank row or column is reached.
The current Region of the Yellow Cell above is the Red Outlined Area
Keyboard
From the keyboard you can do this by pressing Ctrl+* or Ctrl+A, which is a shortcut for GoTo, Special, Current Region.
VBA
In VBA you can use the Range.CurrentRegion property
If there is a block of data in B4:F10 with blank rows & columns around it
Dim myRange as Range
myRange = Range(“C8”).CurrentRegion
will set myRange to $B$4:$F$10
To identify the number of rows in a contiguous region.
e.g. intNumberOfRows = Range(“FirstCell”).CurrentRegion.Rows.Count
003. Select the Current Region using the QAT – Christine
In addition to the techniques described by Peter above, you can select the Current Region by adding an Icon to the Quick Access Toolbar.
Click on any cell and then click on the icon or use Alt+4
004. Find the Alt-Shortcut Key Number for the QAT – Hui
In the “Select the Current Region using the QAT” post above, Christine showed us how to use the Current Region Icon
to quickly select the current Region. But how do we know it is the 4th Icon?
The Alt Number is Position dependent, in the example above the Current Region Icon is the 4th Icon from the Left in the QAT and so it is accessed by Alt+4
But by simply pressing the Alt key, Excel will show you the shortcut numbers for the QAT and all other Tabs
So we can see that the Select the Current Region icons is yes, No 4 and so Alt+4 is required to activate it
We can also see that the Record a Macro icon is number 08. To use that You use Alt+08 (Using the Number keys, not the numeric keypad)
Using Alt also shows you all the Tab shortcuts as well
005. Stay on the Current Cell after you press Enter – MF
Typically when entering data as you press the Enter key, Excel advances the current cell to the next cell as defined in the File, Options, Advanced, Editing Options menu
To stay on the current cell Simply press Ctrl+Enter instead of Enter
You can set your default move direction or disable Move Selection permanently by changing the option in the File, Options, Advanced, Editing Options menu:
006. Close a File Shortcut – Johnathan Cooper
Simply pressing Ctrl+W closes the current file
If the file has changed since the last save you are given the option to Save the file before it closes
007. Keyboard Shortcuts – Chirayu
Hide columns – CTRL + 0
Apply Filter (alternative) – SHIFT + CTRL + L
Clear Filter – ALT + D + F + S
Drag Down – CTRL + D
Drag Right – CTRL + R
Drag Up – ALT + E + I + U
Drag Left – ALT + E + I + L
Value Paste – ALT + E + S + V
Format Paste – ALT + E + S + T
You can find a comprehensive list of Keyboard Shortcuts at: Chandoo.org Keyboard Shortcuts
008. Use AutoCorrect to write formula – Wynn Hopkins
My favorite trick is using AutoCorrect to help write INDEX MATCH formulas..
Copy the following line into AutoCorrect and then use iii as the text to replace
=INDEX( DblClk_to_Select_Column_to_return, MATCH( DblClk_Single_Lookup_Cell, DblClk_Lookup_Column, 0),0)
This way whenever you need INDEX MATCH you just type iii and AutoCorrect kicks in and you are 3 double clicks away from a robust formula.
AutoCorrect is found in the File, Options, Proofing Menu
Contributor: Wyn Hopkins
009. Fill Blanks in a Data Table before use in a Pivot Table – RobD
When building pivot tables, it helps to have a full column of like values, so if you have a set up such as:
Where the data area has blank cell
Use this handy VBA
‘Change the MyCol value to match your value
Becomes…
Note: The code copies the text above the blank cell, and so the user must be careful that this is a valid assumption
010. Fill Blanks in a Data Table before use in a Pivot Table II – Jomili
Extending the technique shown above, Jomili supplied some VBA code that does the same as 007 above, except that it handles Multiple Columns at once as well as allowing Formulas to be converted to Values in the final result
So
becomes
by using this code:
011. QAT Copy/Paste Shortcut – Ian Watkins
By assigning the Copy, Paste Values and Paste Formulas Icons to positions 1, 2 & 3 of the Quick Access Toolbar
Instead of doing a big move of my hand from Ctrl+C to Alt+2, I can just move a finger from Alt+1 t copy
Click on the new cell and press Alt+2 or Alt+3 without moving my hand
Speeds things up quite a bit!
012. Customize Markers in a Chart – Chandeep
Customizing markers in a chart – http://www.goodly.co.in/customize-markers-in-a-chart/
013. Charting Hacks to work faster – Chandeep
Charting Hacks to work faster – http://www.goodly.co.in/5-charting-hacks-to-help-you-work-faster/
014. Seven Date formulas to make life easy – Chandeep
7 Date formulas to make life easy – http://www.goodly.co.in/date-formulas-in-excel/
015. Customised scrollbar using VBA – Chandeep
Customised scrollbar using VBA – http://www.goodly.co.in/customized-scroll-bar-in-excel/
016. Adding Direct Legends – Chandeep
Adding Direct Legends – http://www.goodly.co.in/how-to-add-direct-legends-to-the-chart/
017. Excel Ninja Menu – Krishna Khemraj
Select a cell or range then move till the 4-way cross appears.
Then Right-Click and drag the selection to another place in the worksheet then, like a ninja, a menu full of skills and throwing stars pops up allowing me to do all kinds of awesomeness.
When you click the fill box on a Date and Right Click and Drag it down, a lot of amazing Date options pop up.
018. Copy & Paste Filtered Data Only – Patricia
If you try to copy subtotaled data (and in earlier Excel versions filtered data), when you paste it all the data displays instead of just the summarized data.
To get around this, select your summarized data, click on Find and Select tab and then select Go to Special.
Click Visible cells Only and click Ok.
Now paste and you will see that only the summarized data has been copied.
You can also go CTRL+G and then click the Special icon at the bottom of the dialog box.
019. Clear Filters for the Current Column – Graham
With a table that is filtered, ensure the active cell is in the header of a filtered column and hit ALT + Down Arrow + C to clear the filter for the current column
020. Names Formula Tips – Pedro Paulo
You can bring up the Name Manager in Excel by pressing Ctrl+F3.
This lists the names used in your current workbook, and you can also define new names, edit existing ones or delete names from the Name Manager.
You can define several named ranges using data that’s arranged in neat tables. Excel creates named ranges from your selection and uses your data headings as the new names.
Make sure your data has headings (top row, left column, bottom row or right column) as these will turn into the names of your named ranges
Select the data including headings, press Ctrl+Shift+F3, in the dialog box select where your headings are (top row, left column, bottom row or right column) and click Ok.
Field Names which include spaces will be replaced with underscores
eg: Account Code will become the Account_Code named formula
021. Avoid Division by Zero – Ian Wilson
If a formula returns a number value, the Iferror() function can be used to isolate a returned value of zero.
You just need to utilize reciprocals:
1/(1/x) = x, however, if x = 0, then the function is an error.
My most common use of this feature is to return a blank instead of a 0.
=iferror(1/(1/sum(range)),””)
This could also be used to avoid division by 0 or replace 0s with a string.
022. Text to Columns Shortcut – Vishal Onkar
When working with lots of Text or CSV Files you invariably end up using the Text to Columns function repeatedly
This can be accessed by the ALT+D+E keyboard shortcut
023. Convert a Month in Words to a Month Number – Denys calvin
To convert a month in words (i.e., “August”) to its number (i.e., “8”), use, at least, the first three letters of the word in the following formula: =MONTH(“mmm”&1)
=Month(“March”&1) returns 3
=Month(“Mar”&1) returns 3
024. Trace Precedent/Dependents – Prashant99
Trace precedent cells Ctrl+[
Trace dependent cells F5+Enter or Ctrl+]
025. Resize Columns – Target
I routinely get sheets with data all smashed up which I hate and I’ve never been able to find a shortcut to do this.
To get around this I use the following VBA and assign a shortcut key (CTRL+Q)
It can be a nuisance if I’ve intentionally hidden columns, but the convenience far outweighs the inconvenience
026. Format Table Header Row – Ronnie
I use Tables many times a day and have a simple macro to give me a consistent Table format
The VBA Code:
027. Quickly Jump to Range – Efand
Type the range address directly in the Name Box and then press Enter to select it.
e.g: type A3:A6 will select its ranges without using any clicking and dragging
If you select a Range say B3:B6, then type a Name in the Name Box “From_Date“, Excel sets up a Named Formula referring to that range
If the Named Formula already exists, eg: From_Date, Typing From_Date into the box will take you to it.
You can also use the Drop Down next to the Name Box to select existing Named Ranges
028. Easily delete all Non-Formula cells – Martin
To easily delete all none-formula entries in a worksheet in one go:
Goto Home, Find & Select, Constants
This selects all cells that do not contain a formula.
Then just hit the delete button and you are done!
029. Reset all Cell Comments to the Same Style – Hui
To Reset all Cell Comments to the Same Style simply copy this code into a code module in your workbook
Edit the style parameters to suit your need
Run the code with F5
Closing
Many many thanks to the Microsoft Excel MVPs, Chandoo.org Ninja’s & My Favorite Excel Websites Authors for the 52 and You for the 29 Excel Tips, Tricks, Cheats & Hacks that have been showcased over these past 5 posts.
I hope you get to to revue all the tips and pass comments and appreciation back to the authors as appropriate.
I will re-run this series in May 2017 so keep a list of your new Excel Tips, Tricks or Hacks handy.
If you have any Excel Tips, Tricks or Hacks, Don’t be afraid to share them below in the comments:




































83 Responses to “Merge Cells without Losing Data [Quick Tip]”
Yes, but with your VBA sub, you end up with a delim which should be trimmed.
Unfortunately, the company I work for is using Excel 2003 and the function will not work.
@Gerdami... I know the mistake in code. I left in on as when you concatenate such text, 99% of time you are doing it for cosmetic reasons, so an extra space wouldnt hurt + I wanted to keep the code easy to understand for our readers.
@Steve... I am not sure if that is the case. I just tested the code in Excel 2003 and it works fine. May be when you copied it, all the quotation marks ' " are replaced by wrong characters?
Chandoo, why do you provide screenshots with Excel 2007 and still continue to use Excel 2003 when Excel 2010 is out 🙂
I saw the article about you on msn. It was very inspiring. Thats how I came to know about your blog. You should also check out my blog sometime though I'm just a beginner.
Thanks.
Don't worry Chandoo, thanks for sharing this.
One more gem from Chandoo! Thanks for sharing it 🙂
Wow, I can't remember coming across this Fill>Justify tip before. Nice one. I checked Excel 2003, 2007, 2010, and Mac versions 2008, and 2011 to see if it works and it did. Amazing!
I did have to replace ‘ with ' to designate comments, and
” “ with " " in the Const declaration before my compiler would okay the code.
I did not of Fill/justify before. I noticed it could also split wrapped up text in a cell in multiple cells.
It's much different than setting horizontal text alignment to "Justify" in the format cell dialog.
Personnaly, assuming the text is in column 1, I would use =A1&" "&A2. Copy the formula down to the last row than copy/paste value the result.
Sebastien
This is a wonderful tip! Too bad it only works in Excel 2007! Keep them coming.
Don't recollect the Fill->Justify earlier and to have wasted all that time..........grrrrrrrrrrrrrr
Thanks!
Face this problem many a times.
Many of us face 'another' problem. It's actually lose and not loose. Funny how often this mistake is committed.
cheers,
PSL
Hi Chandoo
Would you consider covering the general topic of converting 2003 VBA code to 2007/10 in a future newsletter - ie what is the process of converting 2003 macros and situations like this?
Cheers
John
@PSL: Oops, I didnt realize the mistake in spelling. Fixed it now. Sadly, the url will retain an extra o.
@Godwin: Because I have all 3 versions installed on my comp!
@Sebastian: I used to the same thing (write =a1&" "&a2 and drag) a while ago. Then I ended up writing a small UDF called as CONCAT that accepts ranges as input and concatenates text in that. It is such a timesaver. Get it here: http://chandoo.org/wp/2008/05/28/how-to-add-a-range-of-cells-in-excel-concat/
@Ninad, Prakash: Thank you. I am happy you like this.
@Kamarrah: It works in Excel 2003 too.
@John: I think all macros written in 2003 work in 2007 without any changes in behavior. I may be wrong. I am not an expert in macros, but I will try to put-together an article on what you asked.
@Chandoo,
Below is your code modified to remove the loop which concatenates the output text together (note that this method does not produce a trailing delimiter in the output string like your code does)...
Sub JoinAndMerge()
' Joins all the content in selected cells
' and puts the resulting text in top most cell
' then merges all cells
Const Delimiter = " "
On Error Resume Next
With Selection
.Item(1).Value = Join(WorksheetFunction.Transpose(Selection), Delimiter)
.Item(2).Resize(Selection.Count - 1).Clear
.Merge
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = True
End With
End Sub
I have a question though... I left it in (because you included it), but why are you setting the WrapText property to True?
@Rick... Good modification. I tried to use Join but failed several times. It didnt occur to me that I need to transpose the data. Thanks for sharing it.
I used the WrapText option so that if the merged text becomes too large, it would wrap nicely inside the cell. I am not sure if without that option the merged content would be visible completely. What do you think?
Oops, it does work in 2003
Don't worry Steve, the problem is with the strange quotes ‘ ” “ displayed on this page.
@Chandoo,
The reason I asked why were you setting the the WrapText property to True was because of this instruction you gave above...
2. Adjust the column width so that you can fit all
contents in one cell. (basically make it wide enough)
If this instruction is followed, then there would be no need to wrap the text. By the way, we can modify this code to handle merging across a single row instead of down a column...
Sub JoinAndMerge()
Const Delimiter = " "
On Error Resume Next
With Selection
.Item(1).Value = Join(WorksheetFunction.Index(Selection.Value, 1, 0), Delimiter)
.Item(2).Resize(1, Selection.Count - 1).Clear
.Merge
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlGeneral
.WrapText = True
End With
End Sub
And, if we want to generalize the code to handle either a selection down a column or across a row automatically, then this code will do that...
Sub JoinAndMerge()
Const Delimiter = " "
On Error Resume Next
With Selection
If Selection.Rows.Count > 1 Then
.Item(1).Value = Join(WorksheetFunction.Transpose(Selection), Delimiter)
.Item(2).Resize(Selection.Count - 1).Clear
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
Else
.Item(1).Value = Join(WorksheetFunction.Index(Selection.Value, 1, 0), Delimiter)
.Item(2).Resize(1, Selection.Count - 1).Clear
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlGeneral
End If
.Merge
.WrapText = True
End With
End Sub
Note that I still retained the WrapText property setting statement (in both of these routines).
Hi Chandoo,
In your latest comment on merging cells, what are the pros and cons of using concatenate command instead of the VBA?
Also, I found a relatively simple link to merge text in cells--check this out
http://www.contextures.com/xlCombine01.html
I got to work! Yeah Chandoo thanks.
Hello Chandoo.
There is a old trick to do that.
If you have the data in a1:a5, select b1:b5 and merge the cells, copy b1:b5, select a1:a5 and Paste Special - Format then you have a1:a5 merged but the individual data in a1:a5 still remains there. If you split the cells a1:a5 you see the individual data again, even with the cells merged you can refers one of them individually.
Kind Regards. César.
Hi Chandoo,
Thank you and I need opposite action to this
If a cell contains multiople data (abc123, def456) seperated by coma/space needs to be splited into new rows below (a new row should be inserted below and the data should be populated) could you suggest...
Cheers, Chandru...
This is the macro I use.
It accounts for columns and rows and will work with normal formulas. Selection must be contiguous. (but that's a given, since we're merging the cells)
Sub MergeCells()
Dim result As String
For Each cell In Selection.Cells
If Not cell.Value = vbNullString Then
result = result & Trim(cell.Value) & " "
End If
Next
Application.CutCopyMode = False
With Selection
.Clear
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.WrapText = True
.MergeCells = True
End With
Selection.Cells(1, 1).Value = result
End Sub
Hi chandoo,
I know one formual to merge the cell in excel woth out losing data, but dnt know how to update here, Pls guide me.
And thanks a lot beca i am very curious to know abt xcel and here ia m learning so many new things.
Merge Cells without Losing Data :
I make macros for this :
Sub lastrow()
Dim lastrow
lastrow = Range("b" & Rows.Count).End(xlUp).Row + 1
Range("B" & lastrow) = Range("A6") + Range("A7")============= Range Can be multiple like range ("A5"), Range("A8") Etc.
End Sub
its very simple to merge cells you can watch it on the next tutrial:
http://www.thebestdata.com/zoom.aspx?menutype=1&auto=2189
Merge cells in Excel 2010
Here is one for you!! I'm still trying to figure out how to make it work.
Just take say 400 rows and 14 to 16 narrow columns as if you were making a bar chart, then merge every second column vertically and fill it in with color. Some of the verticals can be split two or three times vertically. The entire page will probably freeze before you get the columns complete.
Now try and work out a solution the page freeze.
Help! I've used Fill/Justify for years. Just "upgraded" to Excel 2010 for Windows. Cant find Fill Justify. Help!! Microsoft Help is worthless...
Thanks!
@Tim... It is still there. In home riboon, under Fill Option. Press ALT +hfij to access it.
Chandoo, How did you get this ? what made you increase width and select all cells and click fill > justify?? Do you have tie up with Microsoft developers 😉
[...] Merge Several Cells without Loosing Data [macros] Spread some love,It makes you awesome! Tweet [...]
Dear Chandoo,
Many Thanks for all the tips & tricks... i'm learning a lot about excel through this..
just one quick question:
how do you show the steps as a gif animation image? do you use any software? if yes, which one? even i'm curious to create some gif animations which i can show in my ppt 🙂
thanks a ton mate... & wish you & ur family a very happy diwali... 😀
regards
raghu
@Raghu
The aimated images are Animated GIF files
I believe that Chandoo uses TechSmith's, Camtasia Pro screen capture software, although there are a number of screen capture utilities that do the same thing.
What if I want to merge the cells but keep the paragraph formating so instead of one cell with "big fat cell with lots of text"
"big
fat
cell
with
lots
of
text"
Thanks
@Megan
a very simple modification to Chandoo's code will do the trick
.
Sub JoinAndMerge()Dim outputText As String
delim = Chr(10) 'This is the only change
On Error Resume Next
For Each cell In Selection
outputText = outputText & cell.Value & delim
Next cell
With Selection
.Clear
.Cells(1).Value = outputText
.Merge
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = True
End With
End Sub
I cannot get that to work. Is ther some kinda code for inserting a new paragraph kinda like using alt enter when your typing in a cell?
gotta use delim = vbLf
The macro you provide is great and will save me a lot of frustration, but for some reason it seems to strip all of the formatting from the text (font, font size, font color) in the newly merged cell. Is it possible to modify it so that it maintains the original formatting of the cell?
Hi folks,
Pls dont worry all about this...
just omit all the above comments..
-----------------
Just copy all the cells content whichever you need and paste it in notepad,wordpad,or msword and copy all those data from the wordfile and click inside the required cell in excel and paste it...
___________________________
thats it.... All the best
Great help! Keep Rocking (;
Hi chandoo,
I have doubt in excel VBA macro code. can u help me with it.My problem is:
I have multiple vertical cells with values in alternate (leaving 1 cell gap between 2 values)positions eg:
Date
A1: 02/Nov/2011
A2:
A3: 04/Oct/2011
A4:
A5: 12/Oct/2011
A6:
A7: 25/May/2011
21/Oct/2011
now please let me know how do I copy it to the other workbook vertically(continuously) without a gap of 1 cell inbetween 2 values.
The result is supposed to be this:
Date
A1: 02/Nov/2011
A2: 04/Oct/2011
A3: 12/Oct/2011
A4: 25/May/2011
A5: 21/Oct/2011
In sheet 1, select all the cells A1:A10,
press F5
Select Special
Choose Constants
Click ok
Press CTRL+C
Now go to Sheet 2 and Paste
Why not just a simple formula
in Date!A1 put
`=OFFSET(Sheet1!$A$1,2*ROW()-2,)`
thanks for the suggession,
but im trying it with vba. Can u please help me in this regard
hi chandoo,
this is my new problem, i solved the old one.
first i want to search for a string in an existing workbook, if it is found then i need to copy the range below it(till the data is present) into a new workbook using VBA.
Hi, I have a question related to this thread. I have a need to merge columns of data into one cell, with no data loss, but need two additional features: first is to comma seprate the contents of each of the merged cells once they are in the merged cell. second is to do this for individual rows, but whilst selecting multiplw rows - I mean only merge per row into one cell. for example, i want to be able to run the macro by selecting all rows in my worksheet, but have columns merged per row, not all rows and columns merged into one cell in teh top left of the sheet. ie I want a finished sheet of one column with the same number of rows but the columns from each row meged into the first cell of each row.
the closest i have come is with a previous post:
1. Nikki says:
December 20, 2010 at 8:36 pm
This is the macro I use.
It accounts for columns and rows and will work with normal formulas. Selection must be contiguous. (but that’s a given, since we’re merging the cells)
Sub MergeCells()
Dim result As String
For Each cell In Selection.Cells
If Not cell.Value = vbNullString Then
result = result & Trim(cell.Value) & ” ”
End If
Next
Application.CutCopyMode = False
With Selection
.Clear
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.WrapText = True
.MergeCells = True
End With
Selection.Cells(1, 1).Value = result
End Sub
this macro merges all selected columns and rows into the one cell, I want to be able to select multiple columns and rows, but only have row by row merged.
Additionally, ideally as the merge is completed i would like to insert a comma between each of the merged cells contents, once it is merged.
hope I have explained this ok?
any help is much appreciated!
Did you ever solve this?? I need to do the same thing and am lost.
@Frustratedguy
Have you tried this: http://chandoo.org/wp/2008/05/28/how-to-add-a-range-of-cells-in-excel-concat/
Also check the comments as there are lots of extensions to the basic post in the comments
If that doesn't help can you post or email me a sample file?
Hi Chandoo,
Can you tell me how to merge columns without losing the data in the format given below:
column A column b
row 1: abcd xyz
required format:
column A
row 1: abcd xyz
It would save a great amount of my time if i could get a solution to this!
Hi Jo Saave,
you can get the data in col a & col b concatenated in col c. if you need to get the merged data back in col a then you may have to copy paste.
the formula (in col A1) would be =A1&B1"
if you need the space between char in A1 & B1 then it would be
=A1&" "&B1"
hope this helps
regards
raghu
Brilliant!
The Macro works fine and good once the wrong characters are replaced with the correct quotation marks. Thanks, but when the length of the cell is high then values in the two cells will merge in single line. For this I have move to the end of each value and give alt+ enter to move the second value to the next line. Then how to resolve this?
Hi Chandoo -
Thanks for this!
Quick question: I have one column with a list of about 1000 names. Each row is a different name but some rows belong to one family. I am trying to separate each family. In order to do this, I am using your JoinAndMerge() macro. Essentially, I am merging the rows that belong to one family so that they become one cell. I will then use this and use Avery wizard (is that the easiest way to do it?) to print off the names on a avery sticker sheet.
However, when I merge the rows of names, I still need them to be in separate lines. I could do it manually with the char(10) function, but I imagine I could edit your macro a little.
What would you advise here?
Thanks a lot!
Mana
@Mana
I definitely would advise not to use Merge
I would add a new helper/ assistant column called Family
The add a formula to that to add family as appropriate
Hi All,
Any body can sujjest a VBA code for this: use logical condition in other words if column 1 with same information in different rows then join the column 3 with all rows can be joined with a comma delimiter. Here is the Example:
Input
No
Year
Text
A-1
2012
AB
A-1
2012
CD
A-1
2012
EF
B-2
2011
AB
B-2
2011
CD
B-2
2011
EF
Output should be
No
Year
Text
A-1
2012
AB, CD, EF
B-2
2011
AB, CD, EF
Hi All
There is a simple and easy way to merge celles without losing the entire data
=CONCATENATE(cell1,cell2)
thats it
hope it's helpfull
forget something that you add this formula in the next column
regards,
yasser
I was planning to write an email to following addresses:
sdkjfhds@msn.com
kjdafhk@gmail.com
jfh@gmail.com
jhdfjah@djsldf.com
in excel, then I added A1 & ", " to B1 and then I noticed here. Result is perfect.
I have never noticed that fill button before 🙂
You may have already answered this question, but I am such a newbie to excel I am not sure.
I have two columns, A & B.
Column A is the Family Number. (1k family numbers)
Column B is the Unique Name. (50k unique names)
All the Unique Names in Column B need to be merged into 1 single cell according to the Family Number in Column A. I tried using "Justify" but it wraps the names onto multiple rows because I can't make the column wide enough.
I am using excel 2007.
Thank you!
Whitney
Hi Whitney,
See this: http://chandoo.org/wp/2008/05/28/how-to-add-a-range-of-cells-in-excel-concat/
Thank you Mr. Chandoo, it appears you have the answer I need and it will save me many hours of work. Unfortunately my excel skills are so weak that I don't understand where to begin. I will try to find a class on excel programming basics so that I can learn how to implement your suggestion.
Thank you
Whitney
i keep getting a syntax error. and how do i use this?
is there any other fuction that can be used that has the same effect but there will be spce between them?
eg. cat dog and not catdog
@NaaG
See this: http://chandoo.org/wp/2008/05/28/how-to-add-a-range-of-cells-in-excel-concat/
Nice trick
Hi sir i just want a clarification from you that im preparing a travel schedule that consist of onward details and return details .. i just sorted the list based on onward date and time and now i just wanted to insert in the records in word using directory technique. everythng is ok but what the problem is im getting the list in order one below the other but i need 1 2 3 in this way not as
1
2
3
please help me in this regard
great work.. Thanx.. 🙂
We can use conconate function....to merge any cells,,,with text
This is easily possible if the data is in 2 columns. You can use this tool http://www.anotherwaytodothis.com/excel-merge/combine-join-cells.php to merge cells even with data in them.
Very Easy One Thanks,,,:)
[...] This code has been written by Chandoo, you read more ways to tackle this issue on his blog here. [...]
Is it possible to apply this macro to all rows of a 5 x 50 set of data? Sorry, I'm very inexperienced with macros.
Good.
The best solution for my need.
Rgds,
Sumit
@Sumit
Have a read of the posts here:
http://dailydoseofexcel.com/?s=closed+workbook
They have discussed this issue several times
Hello
In a sheet where each column has different conditional formatting, is it possible, in VBA, to merge cells vertically without loosing the conditionnal formatting?
Thank you
Hi thank you very much for the macro, that is a gem!!!
I wanted to know if instead of using selection but if i would like to add a preset range, how do i rewrite the code for this?
For example?
instead of "For Each cell In Selection"
i would like to merge data in a predetermined cell that will not moved.
A1: Apple
A2: orange
A3: banana
A4: Chocolate
A5: Coffee
A6: Tea
A7: Red
A8: Pink
A9: yellow
to become:
apple orange banana <-- as one cell
chocolate coffee tea <-- as one cell
red pink yellow <-- as one cell
Can you pleaseee help me? thank youuuu
how do i do this?
Works Perfectly for me 🙂
Hello Chandoo, this macro works great for my spreadsheet needs, however, a column with several ranges [+5,000] of rows that are needed to apply this VBA takes a lot of time and effort, so deciding to use a colored and alternated background for each range in order to visualize which range needs to be joined and merged easily, is there a way on the VBA to grab each range with the same background to run the VBA and continue with the next range on the different background color until it runs to the end of the last row/range? Thank you.
I have conditional formatting relying on a date where the cell is merged because I had to add another row in order to have the sub contractors listed separately. For example, I have rows 2 and 3 for a task and columns A, B, C, D, E, F, G, H, I, J, K, L, M, N, O and P are all merged however once you get to column Q, R, S, T, U they are no longer merged to show the distinction between the 2 different sub contractors on the task. Column V is merged again. My problem is Column I which is the expiration date of the task is the condition to turn all the cells to the color requested. Because column I is merged the first subcontractor in Row 2, Column Q, R, S, T, U will turn the color but the second sub contractor in Row 3, Column Q, R, S, T and U will not turn the color requested. It will only happen if I don't merge the Column I which has the expiration date and I put the date in both cells (2 and 3). PLEASE HELP IVE BEEN WORKING ON THIS FOR 3 DAYS!!!!!!
Reply
Dear all
how I repeat the word with simple shortcut how I create a macro in it. Like "Pakistani is great" this line is use many time in my sheet how can I make shortcut for it??
thank you so much , fill and justify function helped me and saved lot of time..
thank you .....??
I get in the above cases, the content is being merged from multiple cells into one cell, but how can you merge the content of multiple cells WITHOUT losing the format of the text in those multiple cells into one cell, especially if the final result will result in having more than 255 characters, thus the TEXT property of the CHARACTERS object on the final cell will NOT be available.