Transposing multiple rows to multiple columns

H

heyredone

Hello,

I have a very large amount of data (workday time punch data) that I need to
alter from multiple rows to multiple columns on one row. See small example
of data as follows where FirstName, LastName, Badge, Store, ScanDttm, RAW,
CONVERTED are column headings (A1 thru G1):

FirstName LastName Badge Store ScanDttm RAW CONVERTED
ROBERT H. CASAVAN 600265 1211 1/2/2004 28:00.0 9:28:00 AM
ROBERT H. CASAVAN 600265 1211 1/2/2004 57:00.0 2:57:00 PM
ROBERT H. CASAVAN 600265 1211 1/2/2004 24:00.0 3:24:00 PM
ROBERT H. CASAVAN 600265 1211 1/2/2004 03:00.0 5:03:00 PM
BRIAN BAUM 600760 1211 1/2/2004 36:00.0 9:36:00 AM
BRIAN BAUM 600760 1211 1/2/2004 05:00.0 3:05:00 PM
MICHAEL ANTOSIK 600820 1439 1/2/2004 52:00.0 9:52:00 AM
MICHAEL ANTOSIK 600820 1439 1/2/2004 06:00.0 1:06:00 PM

I want to take the CONVERTED data (time punch in & out time) for ROBERT H.
CASAVAN on 1/2/04 (ScanDttm) and spread those 4 in & out time entries into 1
row and multiple columns. Then the same for BRIAN BAUM, and the same for
MICHAEL ANTOSIK, etc. Each individual will have from 1 to 4 in & out entries
on a given day.

Is there a way to accomplish this without copying and transposing each set
of in & out time entries for each person and each day separately? If so, how
do I do that?

Thank you!
 
S

ShaneDevenshire

Hi,

You can transpose data using either the =TRANSPOSE(A1:A4) function or using
the copy Paste Special Transpose command.

You may want to write a macro to do one or the other of these. But first
test to see which works for you, then record a macro to convert one row of
data and post it as a new question and ask for help generalizing it to n rows
of data.

For the Transpose function you highlight four cells, type the formula and
press Shift Ctrl Enter, to enter it
 
G

Glenn

heyredone said:
Hello,

I have a very large amount of data (workday time punch data) that I need to
alter from multiple rows to multiple columns on one row. See small example
of data as follows where FirstName, LastName, Badge, Store, ScanDttm, RAW,
CONVERTED are column headings (A1 thru G1):

FirstName LastName Badge Store ScanDttm RAW CONVERTED
ROBERT H. CASAVAN 600265 1211 1/2/2004 28:00.0 9:28:00 AM
ROBERT H. CASAVAN 600265 1211 1/2/2004 57:00.0 2:57:00 PM
ROBERT H. CASAVAN 600265 1211 1/2/2004 24:00.0 3:24:00 PM
ROBERT H. CASAVAN 600265 1211 1/2/2004 03:00.0 5:03:00 PM
BRIAN BAUM 600760 1211 1/2/2004 36:00.0 9:36:00 AM
BRIAN BAUM 600760 1211 1/2/2004 05:00.0 3:05:00 PM
MICHAEL ANTOSIK 600820 1439 1/2/2004 52:00.0 9:52:00 AM
MICHAEL ANTOSIK 600820 1439 1/2/2004 06:00.0 1:06:00 PM

I want to take the CONVERTED data (time punch in & out time) for ROBERT H.
CASAVAN on 1/2/04 (ScanDttm) and spread those 4 in & out time entries into 1
row and multiple columns. Then the same for BRIAN BAUM, and the same for
MICHAEL ANTOSIK, etc. Each individual will have from 1 to 4 in & out entries
on a given day.

Is there a way to accomplish this without copying and transposing each set
of in & out time entries for each person and each day separately? If so, how
do I do that?

Thank you!


Array enter (CTRL+SHIFT+ENTER) the following in H2 (adjusting the 9999 to the
correct number of rows in your data):

=IF(AND(COUNTIF($C$2:$C2,$C2)=1,COUNTIF($C$2:$C$9999,$C2)>COLUMN()-8),
LARGE(TRANSPOSE(($C$2:$C$9999=$C2)*$G$2:$G$9999),8+COUNTIF($C$2:$C$9999,$C2)-COLUMN()),"")

Copy across to K2 and down as needed.
 
G

Glenn

Glenn said:
Array enter (CTRL+SHIFT+ENTER) the following in H2 (adjusting the 9999
to the correct number of rows in your data):

=IF(AND(COUNTIF($C$2:$C2,$C2)=1,COUNTIF($C$2:$C$9999,$C2)>COLUMN()-8),
LARGE(TRANSPOSE(($C$2:$C$9999=$C2)*$G$2:$G$9999),8+COUNTIF($C$2:$C$9999,$C2)-COLUMN()),"")


Copy across to K2 and down as needed.


Looks like the TRANSPOSE wasn't needed:

=IF(AND(COUNTIF($C$2:$C2,$C2)=1,COUNTIF($C$2:$C$999,$C2)>COLUMN()-8),
LARGE(($C$2:$C$999=$C2)*$G$2:$G$999,8+COUNTIF($C$2:$C$999,$C2)-COLUMN()),"")
 
H

heyredone

Glenn,
Thank you for your quick response. Okay, I tried the array string you
provided. I get $NUM in K2. What did I do wrong? Also, why am I entering
$C$2 or $C2 ... is that the cell C2? My little chart of data may not have
looked exactly right -- the in & out time punches are located starting in G2
and downward. Just trying to understand.

Thanks so much!
 
G

Glenn

heyredone said:
Glenn,
Thank you for your quick response. Okay, I tried the array string you
provided. I get $NUM in K2. What did I do wrong? Also, why am I entering
$C$2 or $C2 ... is that the cell C2? My little chart of data may not have
looked exactly right -- the in & out time punches are located starting in G2
and downward. Just trying to understand.

Thanks so much!

Not sure why you would get $NUM. The formula will expand to the right as far as
you want. If there is text in the CONVERTED column you get #VALUE!. If you use
exactly the data in your original post, what results do you get in H2:K2?

Yes, I am referencing column C in the formula. I assumed that the Badge number
would be unique for each employee. If that's not right, let me know.

Also, I forgot to include the date, assuming the same badge number will be in
your data for more than one date. Correction as follows (array-entered):

=IF(AND(SUMPRODUCT(($C$2:$C2=$C2)*($E$2:$E2=$E2))=1,
SUMPRODUCT(($C$2:$C999=$C2)*($E$2:$E999=$E2))>COLUMN()-8),
LARGE(($C$2:$C$999=$C2)*($E$2:$E$999=$E2)*$G$2:$G$999,
8+SUMPRODUCT(($C$2:$C999=$C2)*($E$2:$E999=$E2))-COLUMN()),"")

I have data starting in row 2 with column headings in row 1 as follows:

A - FirstName
B - LastName
C - Badge
D - Store
E - ScanDttm
F - RAW
G - CONVERTED

Columns H, I, J and K should be the new columns for your punch times. If that's
not right, let me know and I'll adjust the formula.
 
H

heyredone

Glenn,

Sorry for the delay in responding. Just as I was attempting to get back to
work in the spreadsheet yesterday to include the new array you provided, I
encountered technical difficulties and have not been able to get back into
the document safely. As soon as the issue is resolved, I will try it and let
you know how it turns out.

Thanks!
 
H

heyredone

Glenn,

I was finally able to get back into the document this morning after
addressing the technical issues. I tried the new array you provided me on
your last post -- worked perfectly! Yeah! Thank you so much!

I work quite often on these types of spreadsheets containing time punches
and hours worked data so this array will be great to use when faced with a
similar format of information.

In fact, I have yet another type of spreadsheet of data that I need to work
on that I may need some additional Excel help on. I will post query to the
General Discussion group unless you have the time and/or interest in helping
me with it.

Thank you very much!
 
H

heyredone

Shane,
Thank you for your response. As you can see from the e-mail string, I did
use Glenn's array suggestion and it worked wonderfully.
Thanks again for responding.
 
G

Glenn

heyredone said:
Glenn,

I was finally able to get back into the document this morning after
addressing the technical issues. I tried the new array you provided me on
your last post -- worked perfectly! Yeah! Thank you so much!

I work quite often on these types of spreadsheets containing time punches
and hours worked data so this array will be great to use when faced with a
similar format of information.

In fact, I have yet another type of spreadsheet of data that I need to work
on that I may need some additional Excel help on. I will post query to the
General Discussion group unless you have the time and/or interest in helping
me with it.

Thank you very much!


Glad I could be of assistance. Please post further questions to the newsgroup.
I will look at them if I have time, but if not, someone else surely will help
you.
 
A

Andi Oldner

Hi Glen,

I saw your post on another problem with transposing data. I have one also and hoped you would be able to help me as well. I have over 1000 records similar to the one below in rows; (17 rows separated by a single row). I need to transpose them to the following columns

First/lastname Birth date age Address City State Zip Mother name Father name Mom Phone Dads Phon Email addres School Grade School dist Jersy Pants

Can you help?

Thanks

Andi

First last
08/05/2000
9
1234 Mail Street
town
State
12345
parent m
parent d
555-555-5555
555-555-5555
(e-mail address removed)
school
5
District
JerseyYM
PantYM




Glenn wrote:

Re: Transposing multiple rows to multiple columns
20-Nov-08

heyredone wrote:


Glad I could be of assistance. Please post further questions to the newsgroup.
I will look at them if I have time, but if not, someone else surely will help
you.

Previous Posts In This Thread:

Transposing multiple rows to multiple columns
Hello,

I have a very large amount of data (workday time punch data) that I need to
alter from multiple rows to multiple columns on one row. See small example
of data as follows where FirstName, LastName, Badge, Store, ScanDttm, RAW,
CONVERTED are column headings (A1 thru G1):

FirstName LastName Badge Store ScanDttm RAW CONVERTED
ROBERT H. CASAVAN 600265 1211 1/2/2004 28:00.0 9:28:00 AM
ROBERT H. CASAVAN 600265 1211 1/2/2004 57:00.0 2:57:00 PM
ROBERT H. CASAVAN 600265 1211 1/2/2004 24:00.0 3:24:00 PM
ROBERT H. CASAVAN 600265 1211 1/2/2004 03:00.0 5:03:00 PM
BRIAN BAUM 600760 1211 1/2/2004 36:00.0 9:36:00 AM
BRIAN BAUM 600760 1211 1/2/2004 05:00.0 3:05:00 PM
MICHAEL ANTOSIK 600820 1439 1/2/2004 52:00.0 9:52:00 AM
MICHAEL ANTOSIK 600820 1439 1/2/2004 06:00.0 1:06:00 PM

I want to take the CONVERTED data (time punch in & out time) for ROBERT H.
CASAVAN on 1/2/04 (ScanDttm) and spread those 4 in & out time entries into 1
row and multiple columns. Then the same for BRIAN BAUM, and the same for
MICHAEL ANTOSIK, etc. Each individual will have from 1 to 4 in & out entries
on a given day.

Is there a way to accomplish this without copying and transposing each set
of in & out time entries for each person and each day separately? If so, how
do I do that?

Thank you!
--
heyredone

RE: Transposing multiple rows to multiple columns
Hi,

You can transpose data using either the =TRANSPOSE(A1:A4) function or using
the copy Paste Special Transpose command.

You may want to write a macro to do one or the other of these. But first
test to see which works for you, then record a macro to convert one row of
data and post it as a new question and ask for help generalizing it to n rows
of data.

For the Transpose function you highlight four cells, type the formula and
press Shift Ctrl Enter, to enter it

--
Thanks,
Shane Devenshire


:

Re: Transposing multiple rows to multiple columns
heyredone wrote:


Array enter (CTRL+SHIFT+ENTER) the following in H2 (adjusting the 9999 to the
correct number of rows in your data):

=IF(AND(COUNTIF($C$2:$C2,$C2)=1,COUNTIF($C$2:$C$9999,$C2)>COLUMN()-8),
LARGE(TRANSPOSE(($C$2:$C$9999=$C2)*$G$2:$G$9999),8+COUNTIF($C$2:$C$9999,$C2)-COLUMN()),"")

Copy across to K2 and down as needed.

Re: Transposing multiple rows to multiple columns
Glenn wrote:


Looks like the TRANSPOSE wasn't needed:

=IF(AND(COUNTIF($C$2:$C2,$C2)=1,COUNTIF($C$2:$C$999,$C2)>COLUMN()-8),
LARGE(($C$2:$C$999=$C2)*$G$2:$G$999,8+COUNTIF($C$2:$C$999,$C2)-COLUMN()),"")

Glenn,Thank you for your quick response.
Glenn,
Thank you for your quick response. Okay, I tried the array string you
provided. I get $NUM in K2. What did I do wrong? Also, why am I entering
$C$2 or $C2 ... is that the cell C2? My little chart of data may not have
looked exactly right -- the in & out time punches are located starting in G2
and downward. Just trying to understand.

Thanks so much!
--
heyredone


:

Re: Transposing multiple rows to multiple columns
heyredone wrote:

Not sure why you would get $NUM. The formula will expand to the right as far as
you want. If there is text in the CONVERTED column you get #VALUE!. If you use
exactly the data in your original post, what results do you get in H2:K2?

Yes, I am referencing column C in the formula. I assumed that the Badge number
would be unique for each employee. If that's not right, let me know.

Also, I forgot to include the date, assuming the same badge number will be in
your data for more than one date. Correction as follows (array-entered):

=IF(AND(SUMPRODUCT(($C$2:$C2=$C2)*($E$2:$E2=$E2))=1,
SUMPRODUCT(($C$2:$C999=$C2)*($E$2:$E999=$E2))>COLUMN()-8),
LARGE(($C$2:$C$999=$C2)*($E$2:$E$999=$E2)*$G$2:$G$999,
8+SUMPRODUCT(($C$2:$C999=$C2)*($E$2:$E999=$E2))-COLUMN()),"")

I have data starting in row 2 with column headings in row 1 as follows:

A - FirstName
B - LastName
C - Badge
D - Store
E - ScanDttm
F - RAW
G - CONVERTED

Columns H, I, J and K should be the new columns for your punch times. If that's
not right, let me know and I'll adjust the formula.

Glenn,Sorry for the delay in responding.
Glenn,

Sorry for the delay in responding. Just as I was attempting to get back to
work in the spreadsheet yesterday to include the new array you provided, I
encountered technical difficulties and have not been able to get back into
the document safely. As soon as the issue is resolved, I will try it and let
you know how it turns out.

Thanks!
--
heyredone


:

Glenn,I was finally able to get back into the document this morning after
Glenn,

I was finally able to get back into the document this morning after
addressing the technical issues. I tried the new array you provided me on
your last post -- worked perfectly! Yeah! Thank you so much!

I work quite often on these types of spreadsheets containing time punches
and hours worked data so this array will be great to use when faced with a
similar format of information.

In fact, I have yet another type of spreadsheet of data that I need to work
on that I may need some additional Excel help on. I will post query to the
General Discussion group unless you have the time and/or interest in helping
me with it.

Thank you very much!
--
heyredone


:

Shane,Thank you for your response.
Shane,
Thank you for your response. As you can see from the e-mail string, I did
use Glenn's array suggestion and it worked wonderfully.
Thanks again for responding.
--
heyredone


:

Re: Transposing multiple rows to multiple columns
heyredone wrote:


Glad I could be of assistance. Please post further questions to the newsgroup.
I will look at them if I have time, but if not, someone else surely will help
you.

Re: Transposing multiple rows to multiple columns
Thanks again. I will post to Discussion group.
--
heyredone


:

can this work with text?
Hi Glenn, I have the exact same problem (with only 1 identifier column) but my target data are text...your formula works great with number entries...I was wondering if there is a way to make it work w


Submitted via EggHeadCafe - Software Developer Portal of Choice
BizTalk: Parallel Processing with Correlation
http://www.eggheadcafe.com/tutorial...alk-parallel-processing-with-correlation.aspx
 
C

CellShocked

If you ask in the programming group, someone will write you a small
script that will step through each row of your sheet, and make it into a
columnar fill, and then step to the next row and repeat.

microsoft.public.excel.programming Group added. Maybe it will get
spotted and fixed up.



Snipped
 
J

Jef Gorbach

If you ask in the programming group, someone will write you a small
script that will step through each row of your sheet, and make it into a
columnar fill, and then step to the next row and repeat.

microsoft.public.excel.programming  Group added.  Maybe it will get
spotted and fixed up.


Snipped

sounds easy enough but need more details.
 
P

Pete_UK

Assuming the answer to both questions is yes, then with your headers
in row 1 of Sheet2, put this in A2:

=INDEX(Sheet1!$A:$A,(ROW(A1)-1)*18+COLUMN(A1))

You can then copy it across to Q2, and you will need to format B2 to a
date. Then copy A2:Q2 down as far as necessary. You could fix the
values in Sheet2 and then delete Sheet1.

Hope this helps.

Pete
 
R

raj roger

I have a list of more 60,000 records in one column and i need to transpose multiple rows. In column A each data completed one row is blank up to max... kindly plz anyone help macros for using 2007 excel

need to transpose First Name, Last Name, MDDS, Address, City, State, Zipcode, Phone, Fax, Email Website in rows..

Question :

Column A

Casement, Russell L, DDS
General Practice-MDDS
1355 S Colorado BlvdSte 320
Denver, CO 80222-3316
(303) 758-0866
Fax (303) 758-3657
(e-mail address removed)

Caspers, Susan E, DDS
General Practice-MDDS
3785 Kipling St
Wheat Ridge, CO 86033-5700
(303) 421-1472
Fax (303) 421-0764

Casseday, Bryan S, DDS
General Practice-WELD
1815 61stAveSte 103
Greeley, CO 80634-7995
(970)351-6200
Fax(970) 351-0027

Cassidy, Lucius F Jr, DDS*
Orthodontics-MDDS
7563 S Ivanhoe Way
Centennial, CO 80112-6513
(303)7414628



need a response asap
 
R

raj roger

I have a list of 60,000 records in one column need to transposing in multiple rows... In column each data completed one rows is given need to transposing multiple rows. need response asap..

Casement, Russell L, DDS
General Practice-MDDS
1355 S Colorado BlvdSte 320
Denver, CO 80222-3316
(303) 758-0866
Fax (303) 758-3657
(e-mail address removed)

Caspers, Susan E, DDS
General Practice-MDDS
3785 Kipling St
Wheat Ridge, CO 86033-5700
(303) 421-1472
Fax (303) 421-0764
 
G

Gord Dibben

Try this macro.

Public Sub TransposePersonalData()
'ken johnson July 29, 2006
'transpose uneven sets of data........must have a blank row between
Application.ScreenUpdating = False
Dim rngData As Range
Dim iLastRow As Long
Dim i As Long
Dim iDataColumn As Integer
iDataColumn = Selection.Column
iLastRow = Cells(Application.Rows.Count, iDataColumn).End(xlUp).Row
i = Selection.Row - 1
Do While ActiveCell.Row < iLastRow
i = i + 1
Set rngData = Range(ActiveCell, ActiveCell.End(xlDown))
rngData.Copy
Cells(i, iDataColumn + 1).PasteSpecial Transpose:=True
rngData.Cells(rngData.Cells.Count + 2, 1).Activate
Loop
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub

Delete column A when happy.


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top