Solved

Excel combine cells

Posted on 2014-01-06
6
166 Views
Last Modified: 2014-01-07
Hello,
can you please help,
is there a vba that can find the duplicates names in Column c,
if there are, then combine them to one row, use the first Invoice #,  and add the subtotal, taxes, total.

same thing for Column L.

Number of rows is different all the time.

Please see sample attached.
Any help is appreciated.

thanks
0
Comment
Question by:W.E.B
  • 3
  • 3
6 Comments
 

Author Comment

by:W.E.B
ID: 39760770
Sample attached.
sample.xlsx
0
 
LVL 24

Expert Comment

by:chaau
ID: 39760937
Do you insist on VBA code, or are you happy to use built-in Excel data analysing tools? If the latter, then it can be easily done. Just follow these simple steps.
1. Select first chunk of data you wish to analyse. Make sure you include the heading columns, but do not include the very first row (with 11_DAYS):
Select chunk2. Click on "Filter" button in the "Data" toolbar. You should get the screenshot like this:
Filtered data3. Click on Remove duplicates and in the popup unselect all checkboxes and select only "name"
Remove Duplicates4. That's it:
End result5. You can now click on "Filter" button again to bring the spreadsheet to the normal view.

Do the same thing with your L column
0
 
LVL 24

Expert Comment

by:chaau
ID: 39760947
BTW, the steps above can be recorded as a Macro. Here is a VBA code that does the same thing:
Sub Remove_Duplicates_for_column_C()
'
' Remove_Duplicates_for_column_C Macro
'

'
    Range("A2:G30").Select
    Selection.AutoFilter
    ActiveSheet.Range("$A$2:$G$30").RemoveDuplicates Columns:=3, Header:=xlYes
End Sub

Open in new window

0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:W.E.B
ID: 39760971
Hello,
thanks for the help,

Beside removing the duplicates, I need the summary of the fields.
In the sample ,
I have,
example.

11/30/2012      AT3339       Name 07      523504      $1.00      $2.00      $3.00
11/30/2012      AT3339      Name 07      523505      $1.00      $2.00      $3.00
11/30/2012      AT3339       Name 07      523506      $1.00      $2.00      $3.00

I need this to become
11/30/2012      AT3339      Name 07      523504      $3.00      $6.00      $9.00

thanks
0
 
LVL 24

Accepted Solution

by:
chaau earned 300 total points
ID: 39761030
It is still possible, however some data preparation is required.
1. Insert three empty columns after column G (they will be H, I, J)
2. In the cell H3 type this formula, and hit <Enter>:
=IF($C3=$C4,E3+H4,E3)

Open in new window

Formula3. Replicate this formula across range H3:J30
Formula Replicated4. Copy the content (use Ctrl-C) of the range H3:J30
5. Select Range E3:G30 and use Paste Values option, like this:
paste values6. Now you can delete the columns H, I, J, as they are no longer required.
Now, repeat the steps I have described in my first post to remove duplicates
0
 

Author Closing Comment

by:W.E.B
ID: 39761927
Thank you,
I build on what you posted, and created the VBA,
thanks.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question