Solved

Excel combine cells

Posted on 2014-01-06
6
162 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:Wass_QA
  • 3
  • 3
6 Comments
 

Author Comment

by:Wass_QA
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Wass_QA
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:Wass_QA
ID: 39761927
Thank you,
I build on what you posted, and created the VBA,
thanks.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now