Solved

Seperate, group and sum

Posted on 2013-11-13
10
243 Views
Last Modified: 2013-11-13
Hi,

I have attached a ss where i have two codes in appended in ColA, i need to seperate the XOP codes (after hyphon) as these have instances where they repeat, once seperated and grouped, i need to only have one line of these (the extra lines can be deleted) however i need to sum the numbers before the extra lines are deleted

e.g

Expr1                                                      Cash Transactions
XOP0000000000008661                        1862
XOP0000000000008661                        8068
XOP0000000000008661                        6450

I would like to end up with

XOP0000000000008661                        16470

And the same with all the other numbers, so im looking for one view of each code.

Many thanks
Seamus
EE-Sum-Up-Dupes.xlsx
0
Comment
Question by:Seamus2626
  • 5
  • 5
10 Comments
 

Author Comment

by:Seamus2626
ID: 39644529
Just to clear up, the account number, the account number that is on the left hand side of the hyphon, may contain three different ac numbers, in the example above

DTP0000000000006607/XOP0000000000008661      
DTP0000000000006608/XOP0000000000008661      
DTP0000000000016173/XOP0000000000008661      

You would simply pick

DTP0000000000006607/XOP0000000000008661                     16470


and used the summed up numbers

Thanks
0
 
LVL 24

Expert Comment

by:Steve
ID: 39644598
You can:

Add a column between A and B to create a new "blank" B
Add a name to the top (e.g. "expr2")
Highlight A and use Data>Text to columns > Delimited using "/".
This will split the second portion into column B
Create a pivot table based upon the whole data.
Use pivot table to sum and arange data.

Is this OK? See attached.
EE-Sum-Up-Dupes.xlsx
0
 

Author Comment

by:Seamus2626
ID: 39644679
Thanks Barman, but i need this to be code driven as it may have to operate across many workbooks, and i cant have users engaging with pivots etc

So the code would need to seperate the account and customer ID, then where there is multipe customer ids, sum up the numbers for the multiple ID's and then delete the extra rows e.g


Expr 1                                                                         Cash Transactions M1
AP0000000000012593/IP0000000000017087          55602
AP0000000000012770/IP0000000000017087          26977
AP0000000000012790/IP0000000000017087          10096

We would be left with

AP0000000000012593/IP0000000000017087          92675

Many thanks
Seamus
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 24

Expert Comment

by:Steve
ID: 39644973
Which columns need to be summed... all? M1?
There are a lot of columns there, can sum one or all, but would hate to loose something you need when a line is deleted.
0
 

Author Comment

by:Seamus2626
ID: 39645287
Hi Barman, all columns need summing, thats whats making it so tricky!

Thanks
0
 
LVL 24

Expert Comment

by:Steve
ID: 39645733
Could I ask... how does the data get to the excel file?
If this is a data extraction from a database it would be exceedingly simple to modify an SQL query to output as required.
If not, not a big issue, but worth asking.
0
 

Author Comment

by:Seamus2626
ID: 39645807
Now you say it barman, it does come from an access database, what is your suggestion?

Many thanks
0
 
LVL 24

Accepted Solution

by:
Steve earned 500 total points
ID: 39645879
Change the query to sum them after using a group by clause based upon a "RIGHT" statement...

Can you post the current query.
I will then change it to do the required magic.

Far far easier than using VBA as the result will be as desired.
Will loose the porting to the left of the "/" but will output in seconds and repeat easier.
0
 

Author Closing Comment

by:Seamus2626
ID: 39645889
Thats all good, i know what to do from here!

Thanks
0
 
LVL 24

Expert Comment

by:Steve
ID: 39645924
Glad to hear you are back on track.
ATB
Steve.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

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…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

803 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