Code to produce flatfile...

matthewjapp

Board Regular
Joined
May 14, 2007
Messages
115
Say you have an undefined number of columns A,B,C,D,E etc....

Column A contains a unique key, and B C D E etc are figures relating to the key in A (formulas)

Now say we need to arrange like a flatfile...

A is ID, B is formula 1 with heading Costs, C is formula 2 with heading Profit etc

Say the flatfile is to look like

ID - Type
1 - Costs
2 - Costs
3 - Costs
1 - Profit
2 - Profit
3 - Profit

Only there cound be an undefined number of columns with a heading which needs transposing and carrying down the range of ID's...The constans is the number of ID's..

This seems really simple, but I cannot figure it out myself with code...

Any takers???
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Sorry...result of flat file to be

ID Type AMT
1 Costs 100
2 Costs 200
3 Costs 300
1 Profit 400
2 Profit 300
3 Profit 250
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,879
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top