Solved

Seperate, group and sum

Posted on 2013-11-13
10
262 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: 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!

 
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

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!

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

734 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