Solved

Seperate, group and sum

Posted on 2013-11-13
10
232 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
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.

943 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

9 Experts available now in Live!

Get 1:1 Help Now