Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

Excel combine cells

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
W.E.B
Asked:
W.E.B
  • 3
  • 3
1 Solution
 
W.E.BAuthor Commented:
Sample attached.
sample.xlsx
0
 
chaauCommented:
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
 
chaauCommented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
W.E.BAuthor Commented:
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
 
chaauCommented:
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
 
W.E.BAuthor Commented:
Thank you,
I build on what you posted, and created the VBA,
thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now