Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Convert Row/Column data to Database

Is there any easy method of converting/transposing the data in columns a-c
and rows 1-3 in the first section below to the database setup in the second
setion. The example here can be done manually in a few seconds but this would
not be possible when dealing with over 100 rows and over 13 columns?

a b c
1 10 40 70
2 20 50 80
3 30 60 90

1 a 10
2 a 20
3 a 30
1 b 40
2 b 50
3 b 60
1 c 70
2 c 80
3 c 90

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Convert Row/Column data to Database

Thank you "smartin", that was brilliant, your solution has solved an issue
which had no remedy locally. I would never have come up with the use of
functions "index", "counta" & "mod" for the solution.
Aviaro

"smartin" wrote:

Aviaro wrote:
Is there any easy method of converting/transposing the data in columns a-c
and rows 1-3 in the first section below to the database setup in the second
setion. The example here can be done manually in a few seconds but this would
not be possible when dealing with over 100 rows and over 13 columns?

a b c
1 10 40 70
2 20 50 80
3 30 60 90

1 a 10
2 a 20
3 a 30
1 b 40
2 b 50
3 b 60
1 c 70
2 c 80
3 c 90

Thanks


Here's a way, but I am curious what others will come up with.

Set up your original table in Sheet1 and the following in a separate
worksheet for clarity.

Column labels in row 1:
A: Row index
B: Column index
C: Row label
D: Column label
E: Data

Formulae in row 2:
A: 1
B: 1
C: =INDEX(Sheet1!$A$2:$A$4,A2) 'reference the row labels in Sheet1
D: =INDEX(Sheet1!$B$1:$D$1,B2) 'reference the col labels in Sheet1
E: =INDEX(Sheet1!$B$2:$D$4,A2,B2) 'reference the data only in Sheet1

Formulae in row 3 and fill down as far as needed:
A: =A2+(B3=1)
B: =MOD(B2,COUNTA(Sheet1!$B$1:$D$1))+1 'reference the col labels in Sheet1
C,D,E: fill down from row 2

Adjust ranges 'as noted

Columns C-E on the new worksheet have the layout you are looking for.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 915
Default Convert Row/Column data to Database

Divide & Conquer! It's just a looping mechanism really.

Ironically, I never had occasion to use this method before, but I did
need it only three days after posting.


Aviaro wrote:
Thank you "smartin", that was brilliant, your solution has solved an issue
which had no remedy locally. I would never have come up with the use of
functions "index", "counta" & "mod" for the solution.
Aviaro

"smartin" wrote:

Aviaro wrote:
Is there any easy method of converting/transposing the data in columns a-c
and rows 1-3 in the first section below to the database setup in the second
setion. The example here can be done manually in a few seconds but this would
not be possible when dealing with over 100 rows and over 13 columns?

a b c
1 10 40 70
2 20 50 80
3 30 60 90

1 a 10
2 a 20
3 a 30
1 b 40
2 b 50
3 b 60
1 c 70
2 c 80
3 c 90

Thanks

Here's a way, but I am curious what others will come up with.

Set up your original table in Sheet1 and the following in a separate
worksheet for clarity.

Column labels in row 1:
A: Row index
B: Column index
C: Row label
D: Column label
E: Data

Formulae in row 2:
A: 1
B: 1
C: =INDEX(Sheet1!$A$2:$A$4,A2) 'reference the row labels in Sheet1
D: =INDEX(Sheet1!$B$1:$D$1,B2) 'reference the col labels in Sheet1
E: =INDEX(Sheet1!$B$2:$D$4,A2,B2) 'reference the data only in Sheet1

Formulae in row 3 and fill down as far as needed:
A: =A2+(B3=1)
B: =MOD(B2,COUNTA(Sheet1!$B$1:$D$1))+1 'reference the col labels in Sheet1
C,D,E: fill down from row 2

Adjust ranges 'as noted

Columns C-E on the new worksheet have the layout you are looking for.

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
Convert Excel database to dBASE database? RPI Marketeer Excel Discussion (Misc queries) 1 January 18th 08 06:25 PM
How to Create Database from Single Column of Data Gary B Excel Discussion (Misc queries) 2 June 20th 07 06:03 PM
Column width - Data connected to Database UT Excel Discussion (Misc queries) 0 April 23rd 07 07:08 PM
Convert MS Excel data to MS Access database HelpJim Excel Worksheet Functions 6 January 2nd 06 03:51 PM
convert column worksheet to database PK Excel Discussion (Misc queries) 1 November 8th 05 02:06 PM


All times are GMT +1. The time now is 12:08 PM.

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

About Us

"It's about Microsoft Excel"