Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Data Flipping - Approach with formula?

Ok, rather than data flipping, maybe this can be done with a sophisticated
formula. IF I had the customer numbers lined up (ie all 145's were in
column B, all 167's were in column C), I could write a VLookup to find
CLAIMED PHONE, and then the column index number I would use a Find statement
to find the customer #. But since the customers are in different columns,
how could I use the find? Conceptually, I would - Do the VLookup for
CLAIMED PHONE, and use the Find to locate the customer #, but the find would
look in the range exactly 1 row above where the Vlookup found CLAIMED PHONE.
I'm pretty sure that has to be a VB formula. Am I on the right track? Is
something like this possible?

Customer 145 167 179 182 183
CLAIMED PHONE 1 32172 1 27912 542

Customer 167 182 Total
NO STATUS 1 1 2

Customer 167 182 183 189 205
NON DELIVERABLE 2167 1109 7 243 2


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Data Flipping - Approach with formula?

Hi,
Some basic "starter code" which assumes the Text is column A
("CUSTOMER" & "CLAIMED PHONE "and data in columm B onwards. This places
output in column J (for demo only).

You need to add looping logic (which change values of r and rr) to transpose
all your data.

Try with this data in rows 1! and 2

Customer 145 167 179 182 183
CLAIMED PHONE 1 32172 1 27912 542


r = 1 ' First row of input
rr = 2 ' first row of output
Lastcol = Cells(1, Columns.Count).End(xlToLeft).Column
Range(Cells(r, 2), Cells(r + 1, Lastcol)).Copy
Cells(rr, 10) = Cells(r + 1, "A") ' Copy title i.e row 2 data
Cells(rr + 1, 10).PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True


HTH


"Steph" wrote:

Ok, rather than data flipping, maybe this can be done with a sophisticated
formula. IF I had the customer numbers lined up (ie all 145's were in
column B, all 167's were in column C), I could write a VLookup to find
CLAIMED PHONE, and then the column index number I would use a Find statement
to find the customer #. But since the customers are in different columns,
how could I use the find? Conceptually, I would - Do the VLookup for
CLAIMED PHONE, and use the Find to locate the customer #, but the find would
look in the range exactly 1 row above where the Vlookup found CLAIMED PHONE.
I'm pretty sure that has to be a VB formula. Am I on the right track? Is
something like this possible?

Customer 145 167 179 182 183
CLAIMED PHONE 1 32172 1 27912 542

Customer 167 182 Total
NO STATUS 1 1 2

Customer 167 182 183 189 205
NON DELIVERABLE 2167 1109 7 243 2



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Data Flipping - Approach with formula?

Some more useful code. Assumes input data is in consecutive pairs of rows i.e
1,2/3,4 etc. Output is to a new sheet.

Sub FlipData()

Set ws1 = Worksheets("Sheet1")
Set ws2 = Worksheets("Sheet2")

rr = 1 ' first row of output
ws1.Activate
Lastrow = ws1.Cells(Rows.Count, "A").End(xlUp).Row


With ws1
For r = 1 To Lastrow Step 2
Lastcol = .Cells(r, Columns.Count).End(xlToLeft).Column
.Range(.Cells(r, 2), .Cells(r + 1, Lastcol)).Copy
ws2.Cells(rr, 1) = .Cells(r + 1, "A") ' Copy title i.e row 2 data
ws2.Cells(rr + 1, 1).PasteSpecial Paste:=xlPasteAll,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
rr = rr + Lastcol + 1
Next r
End With
End Sub


HTH

"Toppers" wrote:

Hi,
Some basic "starter code" which assumes the Text is column A
("CUSTOMER" & "CLAIMED PHONE "and data in columm B onwards. This places
output in column J (for demo only).

You need to add looping logic (which change values of r and rr) to transpose
all your data.

Try with this data in rows 1! and 2

Customer 145 167 179 182 183
CLAIMED PHONE 1 32172 1 27912 542


r = 1 ' First row of input
rr = 2 ' first row of output
Lastcol = Cells(1, Columns.Count).End(xlToLeft).Column
Range(Cells(r, 2), Cells(r + 1, Lastcol)).Copy
Cells(rr, 10) = Cells(r + 1, "A") ' Copy title i.e row 2 data
Cells(rr + 1, 10).PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True


HTH


"Steph" wrote:

Ok, rather than data flipping, maybe this can be done with a sophisticated
formula. IF I had the customer numbers lined up (ie all 145's were in
column B, all 167's were in column C), I could write a VLookup to find
CLAIMED PHONE, and then the column index number I would use a Find statement
to find the customer #. But since the customers are in different columns,
how could I use the find? Conceptually, I would - Do the VLookup for
CLAIMED PHONE, and use the Find to locate the customer #, but the find would
look in the range exactly 1 row above where the Vlookup found CLAIMED PHONE.
I'm pretty sure that has to be a VB formula. Am I on the right track? Is
something like this possible?

Customer 145 167 179 182 183
CLAIMED PHONE 1 32172 1 27912 542

Customer 167 182 Total
NO STATUS 1 1 2

Customer 167 182 183 189 205
NON DELIVERABLE 2167 1109 7 243 2



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Data Flipping - Approach with formula?

Fantastic! Thanks so much for your help!!!!!!

"Toppers" wrote in message
...
Some more useful code. Assumes input data is in consecutive pairs of rows

i.e
1,2/3,4 etc. Output is to a new sheet.

Sub FlipData()

Set ws1 = Worksheets("Sheet1")
Set ws2 = Worksheets("Sheet2")

rr = 1 ' first row of output
ws1.Activate
Lastrow = ws1.Cells(Rows.Count, "A").End(xlUp).Row


With ws1
For r = 1 To Lastrow Step 2
Lastcol = .Cells(r, Columns.Count).End(xlToLeft).Column
.Range(.Cells(r, 2), .Cells(r + 1, Lastcol)).Copy
ws2.Cells(rr, 1) = .Cells(r + 1, "A") ' Copy title i.e row 2

data
ws2.Cells(rr + 1, 1).PasteSpecial Paste:=xlPasteAll,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
rr = rr + Lastcol + 1
Next r
End With
End Sub


HTH

"Toppers" wrote:

Hi,
Some basic "starter code" which assumes the Text is column A
("CUSTOMER" & "CLAIMED PHONE "and data in columm B onwards. This places
output in column J (for demo only).

You need to add looping logic (which change values of r and rr) to

transpose
all your data.

Try with this data in rows 1! and 2

Customer 145 167 179 182 183
CLAIMED PHONE 1 32172 1 27912 542


r = 1 ' First row of input
rr = 2 ' first row of output
Lastcol = Cells(1, Columns.Count).End(xlToLeft).Column
Range(Cells(r, 2), Cells(r + 1, Lastcol)).Copy
Cells(rr, 10) = Cells(r + 1, "A") ' Copy title i.e row 2 data
Cells(rr + 1, 10).PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True


HTH


"Steph" wrote:

Ok, rather than data flipping, maybe this can be done with a

sophisticated
formula. IF I had the customer numbers lined up (ie all 145's were in
column B, all 167's were in column C), I could write a VLookup to find
CLAIMED PHONE, and then the column index number I would use a Find

statement
to find the customer #. But since the customers are in different

columns,
how could I use the find? Conceptually, I would - Do the VLookup for
CLAIMED PHONE, and use the Find to locate the customer #, but the find

would
look in the range exactly 1 row above where the Vlookup found CLAIMED

PHONE.
I'm pretty sure that has to be a VB formula. Am I on the right track?

Is
something like this possible?

Customer 145 167 179 182 183
CLAIMED PHONE 1 32172 1 27912 542

Customer 167 182 Total
NO STATUS 1 1 2

Customer 167 182 183 189 205
NON DELIVERABLE 2167 1109 7 243 2





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
Flipping row data vertically!! [email protected] Excel Worksheet Functions 1 March 1st 07 11:58 PM
Flipping Data in Excel August Excel Worksheet Functions 3 January 11th 07 09:55 PM
Data Flipping Steph[_6_] Excel Programming 1 November 1st 05 06:22 PM
Data Flipping alamsemu Excel Discussion (Misc queries) 1 March 10th 05 05:56 AM
Flipping Cell Data Horizontal/Vertical Shepherd Moon[_2_] Excel Programming 2 October 3rd 03 06:11 PM


All times are GMT +1. The time now is 05:55 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"