PC Review


Reply
Thread Tools Rate Thread

How to create a macro to replace one line with a few new lines?

 
 
Binyaaust
Guest
Posts: n/a
 
      17th Jun 2008
I have an Excel technical problem to split the cost between divisions. Please
help to create a macro to replace my manual process.

e.g. I have the following data
Division Cost
General 100
Admin 150

If the Division is General, the cost need be split by Key 1, if it is Admin,
split by Key 2, and the original lines will be replaced by three different
lines

Division A Division B Division C
Key1 50% 30% 20%
Key2 70% 0 30%

the result:

Division Cost
Division A 50
Division B 30
Division C 20
Division A 105
Division B 0
Division C 45

Please help! Thanks!!

 
Reply With Quote
 
 
 
 
Pete_UK
Guest
Posts: n/a
 
      17th Jun 2008
In reality, do you have far more data than this? If so, please give
further details.

Pete

On Jun 17, 7:48*am, Binyaaust <Binyaa...@discussions.microsoft.com>
wrote:
> I have an Excel technical problem to split the cost between divisions. Please
> help to create a macro to replace my manual process.
>
> e.g. I have the following data
> Division * * * *Cost
> General 100
> Admin * * * 150
>
> If the Division is General, the cost need be split by Key 1, if it is Admin,
> split by Key 2, and the original lines will be replaced by three different
> lines
>
> * * * * Division A * * *Division B * * *Division C
> Key1 * *50% * * 30% * * 20%
> Key2 * *70% * * 0 * * * 30%
>
> the result:
>
> Division * * * *Cost
> Division A * * *50
> Division B * * *30
> Division C * * *20
> Division A * * *105
> Division B * * *0
> Division C * * *45
>
> Please help! Thanks!!


 
Reply With Quote
 
Binyaaust
Guest
Posts: n/a
 
      18th Jun 2008
Here is the first line of my real data:

YEAR PERD PC ACCT AMT DESC Division
2008 1 611 11600 450 236203 KLIKON K9

If the Division is K9, I would like to delete this line and replace it with
5 lines for each sub-division based on the key allocation below. The AMT
column will be calculated based on the % of the key.

KEYTYPE AIF AII AIP GAP CTS TOTAL
K9 17.00% 22.80% 18.10% 2.50% 39.60% 100.00%

It should have result:

YEAR PERD PC ACCT AMT DESC Division
2008 1 611 11600 76.5 236203 KLIKON AIF
2008 1 611 11600 102.6 236203 KLIKON AII
2008 1 611 11600 81.45 236203 KLIKON AIP
2008 1 611 11600 11.25 236203 KLIKON GAP
2008 1 611 11600 178.2 236203 KLIKON CTS

All information will be the same as original line except the re-calculated
AMT and Division name.

Hope this explain the detail to you.

Thanks,

"Pete_UK" wrote:

> In reality, do you have far more data than this? If so, please give
> further details.
>
> Pete
>
> On Jun 17, 7:48 am, Binyaaust <Binyaa...@discussions.microsoft.com>
> wrote:
> > I have an Excel technical problem to split the cost between divisions. Please
> > help to create a macro to replace my manual process.
> >
> > e.g. I have the following data
> > Division Cost
> > General 100
> > Admin 150
> >
> > If the Division is General, the cost need be split by Key 1, if it is Admin,
> > split by Key 2, and the original lines will be replaced by three different
> > lines
> >
> > Division A Division B Division C
> > Key1 50% 30% 20%
> > Key2 70% 0 30%
> >
> > the result:
> >
> > Division Cost
> > Division A 50
> > Division B 30
> > Division C 20
> > Division A 105
> > Division B 0
> > Division C 45
> >
> > Please help! Thanks!!

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
a macro to copy only 2 lines w/i a cell separated by 4 line breaks poltpar Microsoft Excel Programming 1 15th Apr 2010 12:32 AM
Adding lines together to create one line clalc Microsoft Access Queries 4 21st Mar 2010 04:41 PM
Create a macro to create excel line graph with coloured pointers anddata lables anuj datta Microsoft Excel Charting 1 30th Sep 2009 04:04 PM
macro to insert blank line when lines sum to zero =?Utf-8?B?VENvYXRz?= Microsoft Excel Misc 0 2nd Jul 2007 05:08 PM
How do I create a macro that uses the Replace command? =?Utf-8?B?YmV2ZXJseWRhd24=?= Microsoft Word Document Management 1 26th Feb 2007 03:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:30 AM.