Solved

Seperate, group and sum

Posted on 2013-11-13
10
263 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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;…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

636 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