#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default VBA help

I need some help in creating a procedure that will evaluate whether criteria
is met and if it is met add together the amounts of those rows and then
delete the pre-existing rows. I'll show a small sample of a before and after.

Before picture
Row Criteria Info
Amt
1 53411412312P14 Refund 226786 6527212 12.49
2 53411412312P14 Refund 226786 6561653 1.58
3 95611412312P15 Refund 227766 6505267 27.2
4 95513412312P16 Refund 244221 6292477 20
5 95513412312P16 Refund 244221 6330954 20
6 95513412312P16 Refund 244221 6382828 20
7 51711412312P17 Refund 249575 6391292 17.6
8 51711412312P17 Refund 249575 6556607 16.6
9 53211412312P18 Refund 305592 6428055 477

After
A 53411412312P14 Refund 226786 6527212 14.07
B 95611412312P15 Refund 227766 6505267 27.2
C 95513412312P16 Refund 244221 6292477 60
D 51711412312P17 Refund 249575 6391292 34.2
E 53211412312P18 Refund 305592 6428055 477

Actually, my criteria column is a formula that concatenates 3 other columns
together and basically what I want is to find the Refunds where those three
items are the same and adds those row amounts together then deletes the rows
containing the previous amounts. Rows 1 & 2 in the Before were replaced with
Row A in after, rows 4,5 & 6 were replaced with C and rows 7 & 8 were
replaced with D.
Hope that is clear enough to receive help. I really appreciate your time!
Thank you.
Constance
  #2   Report Post  
Posted to microsoft.public.excel.misc
JCS JCS is offline
external usenet poster
 
Posts: 93
Default VBA help

Hi Constance,
Try using a pivot table to achieve what you are looking for unless you
really need to have rows deleted. I tried it with your data and it works
well. This method allows you to preserve your data. If you decide to use a
pivot table you need to have field names above your data.

HTH,
John

"Constance" wrote:

I need some help in creating a procedure that will evaluate whether criteria
is met and if it is met add together the amounts of those rows and then
delete the pre-existing rows. I'll show a small sample of a before and after.

Before picture
Row Criteria Info
Amt
1 53411412312P14 Refund 226786 6527212 12.49
2 53411412312P14 Refund 226786 6561653 1.58
3 95611412312P15 Refund 227766 6505267 27.2
4 95513412312P16 Refund 244221 6292477 20
5 95513412312P16 Refund 244221 6330954 20
6 95513412312P16 Refund 244221 6382828 20
7 51711412312P17 Refund 249575 6391292 17.6
8 51711412312P17 Refund 249575 6556607 16.6
9 53211412312P18 Refund 305592 6428055 477

After
A 53411412312P14 Refund 226786 6527212 14.07
B 95611412312P15 Refund 227766 6505267 27.2
C 95513412312P16 Refund 244221 6292477 60
D 51711412312P17 Refund 249575 6391292 34.2
E 53211412312P18 Refund 305592 6428055 477

Actually, my criteria column is a formula that concatenates 3 other columns
together and basically what I want is to find the Refunds where those three
items are the same and adds those row amounts together then deletes the rows
containing the previous amounts. Rows 1 & 2 in the Before were replaced with
Row A in after, rows 4,5 & 6 were replaced with C and rows 7 & 8 were
replaced with D.
Hope that is clear enough to receive help. I really appreciate your time!
Thank you.
Constance

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default VBA help

Well, my problem is that we get this info periodically and I left off many
columns in the sample for ease of viewing and we need the other columns as
this spreadsheet is then used to upload into a different application. The
other columns contain dates, names, addresses, dept numbers, account numbers,
etc.
--
Constance


"JCS" wrote:

Hi Constance,
Try using a pivot table to achieve what you are looking for unless you
really need to have rows deleted. I tried it with your data and it works
well. This method allows you to preserve your data. If you decide to use a
pivot table you need to have field names above your data.

HTH,
John

"Constance" wrote:

I need some help in creating a procedure that will evaluate whether criteria
is met and if it is met add together the amounts of those rows and then
delete the pre-existing rows. I'll show a small sample of a before and after.

Before picture
Row Criteria Info
Amt
1 53411412312P14 Refund 226786 6527212 12.49
2 53411412312P14 Refund 226786 6561653 1.58
3 95611412312P15 Refund 227766 6505267 27.2
4 95513412312P16 Refund 244221 6292477 20
5 95513412312P16 Refund 244221 6330954 20
6 95513412312P16 Refund 244221 6382828 20
7 51711412312P17 Refund 249575 6391292 17.6
8 51711412312P17 Refund 249575 6556607 16.6
9 53211412312P18 Refund 305592 6428055 477

After
A 53411412312P14 Refund 226786 6527212 14.07
B 95611412312P15 Refund 227766 6505267 27.2
C 95513412312P16 Refund 244221 6292477 60
D 51711412312P17 Refund 249575 6391292 34.2
E 53211412312P18 Refund 305592 6428055 477

Actually, my criteria column is a formula that concatenates 3 other columns
together and basically what I want is to find the Refunds where those three
items are the same and adds those row amounts together then deletes the rows
containing the previous amounts. Rows 1 & 2 in the Before were replaced with
Row A in after, rows 4,5 & 6 were replaced with C and rows 7 & 8 were
replaced with D.
Hope that is clear enough to receive help. I really appreciate your time!
Thank you.
Constance

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"