As the doctor gone rogue

November 21, 2011

Converting Column Data to Table (2)

Filed under: Uncategorized — hypotheses @ 6:03 pm

Last time I wrote about converting column to table in Excel. Today, I have to do this again, and went back to read what I wrote. One of the new problems that I have today is that I have multiple columns in Table A. But, I want to convert this long table into Table B.

The problem is essentially similar to having a data in Long Format (one individual has multiple line for each variable).

The formula I posted last time was essentially following this format.

=OFFSET(REF_CELL, p*COL_AWAY_FROM_REFERENCE+ROW_AWAY_FROM_REFERENCE,0,1,1)

This still applies. From the example I used last time,

For example, your original data is from $B$2:$B$100, containing item 1 to 9 (i.e. p =9, of 11 repeated measurements). You want to cut row 11-19 and put it right next to B2:B10. Instead, put this =OFFSET($B$2,9*(COLUMN()-COLUMN($B$2))+(ROW()-ROW($B$2)),0,1,1) in cell C2, then copy it to C2:L2, then copy it cover C10:L10. This will give you a 9 row by 11 column table.

If you don’t want to put the new data right next to the old data, but want the first cell of the new table to be “H1”. What you have to do is the change the reference for calculating the distance from the reference cell. In this case, I change $B$2 [the previous first cell of the new table] to $H$1. And, it is as simple as that.

=OFFSET($B$2,9*(COLUMN()-COLUMN($H$1))+(ROW()-ROW($H$1)),0,1,1)

 

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: