Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default How to create a macro to replace one line with a few new lines?

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!!

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default How to create a macro to replace one line with a few new lines?

In reality, do you have far more data than this? If so, please give
further details.

Pete

On Jun 17, 7:48*am, Binyaaust
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!!


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default How to create a macro to replace one line with a few new lines

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
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
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to insert blank line when lines sum to zero TCoats Excel Discussion (Misc queries) 0 July 2nd 07 05:08 PM
macro for fixed color lines in line chart based on series name sm Charts and Charting in Excel 1 November 13th 06 09:31 AM
How do I create a macro that will automatically input lines? cporter Setting up and Configuration of Excel 1 February 22nd 06 10:18 AM
10 000 Line, every 2 Lines need a border and a open line inbet. e. annalie Excel Discussion (Misc queries) 2 January 30th 06 03:15 PM
How do I create vertical lines in a line chart? jrmruz Charts and Charting in Excel 2 June 1st 05 02:41 PM


All times are GMT +1. The time now is 03:22 PM.

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"