Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / March 2008

Tip: Looking for answers? Try searching our database.

Move data in cells araound

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mikebres - 05 Mar 2008 01:01 GMT
Hi All,  I have some data in an unfriendly format.  It's organized like this:

xxxyyyzzzaaabbbcccdddeeefff
ggghhhiiijjjkkklllmmmnnn
ooopppqqqrrr

I'm looking for a way to reorganize it so it its more like this:
xxx
yyy
zzz
aaa
bbb
etc.

I will be having to do this on a weekly basis.  So I'm looking for a
repeatable way to do this.

Does anybody have a good suggestion on how I would accomplish this?

Thanks
Mike
Gord Dibben - 05 Mar 2008 01:07 GMT
Is the data all in one cell in the format you show?

Gord Dibben  MS Excel MVP

>Hi All,  I have some data in an unfriendly format.  It's organized like this:
>
[quoted text clipped - 17 lines]
>Thanks
>Mike
mikebres - 05 Mar 2008 17:08 GMT
No, it's 18 cells across and three cells down.  Also, it won't always be in
the same cells, but it will be the same deminsions 3x18.

I was ttrying to use a macro with arrays, but I couldn't get my head around
transferring the data from a (3,18) array to a (15,3) array.

Mike

> Is the data all in one cell in the format you show?
>
[quoted text clipped - 21 lines]
> >Thanks
> >Mike
Ron Rosenfeld - 05 Mar 2008 20:17 GMT
>No, it's 18 cells across and three cells down.  Also, it won't always be in
>the same cells, but it will be the same deminsions 3x18.
>
>I was ttrying to use a macro with arrays, but I couldn't get my head around
>transferring the data from a (3,18) array to a (15,3) array.

Are you sure that's what you want to do?

A 3x18 array has 54 elements
A 15x3 array has 45 elements

How do you want to handle the nine element difference?
--ron
mikebres - 05 Mar 2008 20:45 GMT
I was just keeping the deminsions uniform, the source data doesn't fill all
the cells.  The nine extra cells are blank, so I would have three blank lines
at the bottom.

However, if you have a better way I would certainly be interested...

Mike

> >No, it's 18 cells across and three cells down.  Also, it won't always be in
> >the same cells, but it will be the same deminsions 3x18.
[quoted text clipped - 9 lines]
> How do you want to handle the nine element difference?
> --ron
Ron Rosenfeld - 05 Mar 2008 21:15 GMT
>I was just keeping the deminsions uniform, the source data doesn't fill all
>the cells.  The nine extra cells are blank, so I would have three blank lines
[quoted text clipped - 3 lines]
>
>Mike

It is still not clear to me exactly what your layout is, or your desired
results.

In your original post, it appeared as if you wanted three letters in one cell.

From this latest post, it seems you want three cells.

If all you want to do is change an 18x3 array to a 3x18 array, merely

1.  Select your original array
2.  Edit/Copy
3.  Select a destination cell
4.  Edit/Paste Special/Transpose

If you want something different, you'll need to be more specific
--ron
mikebres - 05 Mar 2008 22:17 GMT
Okay,

The data is laid out in cells.  One number to each cell.  Each group of 3
numbers left to right are a set.  A Total, Success, Percent set.  They are 18
cells across and 3 cells down with the last nine cells on the 3rd row empty.  
The representation below shows the actual data with the | as an indication of
where each cell starts and ends.  I chopped off the last couple of cells in
the reprsentation below to avoid the word wrap.

62 | 55 | 89 | 118 | 103 | 87 | 61 | 56 | 92 | 78 | 63 | 81 | 59 | 48 | 81 |
34 |
91 | 79 | 87 | 55 | 52 | 95 | 63 | 57 | 90 | 81 | 69 | 85 | 98 | 90 | 92 |
106 |
48 | 46 | 96 | 92 | 82 | 89 | 1046 | 926 | 89 |  |  |  |  |  |  |  |  |

I'm looking for a way to get this data into nice organized columns of  
Total, Success, and Percent like this.  

|Tot   | Suc| %Suc |
| 62   | 55  | 89      |
| 118 | 103 | 87     |
| 61   | 56  | 92      |
etc.
kounoike - 06 Mar 2008 07:21 GMT
Assuming your source data starts at A1, put the formula below into the first
Cell where you want to tranfer data.
then, copy it three cells left and again copy that range down to where you
want.
if your data start elsewhere, change the first arguments in OFFSET, in this
case $A$1, to the cell in your case.

=OFFSET($A$1,((3*ROW(A1)+COLUMN(A1)-4)/18),MOD((3*ROW(A1)+COLUMN(A1)-4),18))

if you prefer using a macro to a formula, try this one.
Assuming your source data start at A1 in Activesheet, and destination starts
at A2 in the worksheet named Sheet2.
if this is not your case, change the code Set start = Cells(1, "A") and Set
dst = Worksheets("Sheet2").Cells(2, "A") below according to your case.

Sub mytest()
Dim start As Range
Dim tmp As Range
Dim dst As Range
Const count = 3 'Number of Cells in one set
Const columncount = 18 'Number of columns in a row

'start is a first Cell where your first data in a group is populated
Set start = Cells(1, "A")
'dst is a first Cell where your data in a group is transfered
Set dst = Worksheets("Sheet2").Cells(2, "A")

Do While (start <> "")
   Set tmp = start
   For i = 1 To columncount / count
       dst.Resize(1, count) = tmp.Resize(1, count).Value
       Set tmp = tmp.Offset(0, count)
       Set dst = dst.Offset(1, 0)
   Next i
   Set start = start.Offset(1, 0)
Loop
End Sub

keiji

> Okay,
>
[quoted text clipped - 24 lines]
> | 61   | 56  | 92      |
> etc.
Ron Rosenfeld - 06 Mar 2008 19:32 GMT
>Okay,
>
[quoted text clipped - 19 lines]
>| 61   | 56  | 92      |
>etc.

OK, that's much more clear than your initial post.

I am assuming that the data really IS 18 cells across, as I am only seeing 16
in what you've posted.  But you can always change the formula below
appropriately.

1.  I NAME'd the data table Tbl.
2.  In some cell, enter this formula:

=INDEX(Tbl,INT((ROWS($1:1)-1)/18)+1,MOD(ROWS($1:1)-1,18)+1)

Fill down as far as required.  You'll start to get #REF errors when you have
gone far enough.  If that will be a problem, you can always do a TEST to
prevent it:

=IF(ROWS($1:1)>COUNTA(Tbl),"",
INDEX(Tbl,INT((ROWS($1:1)-1)/18)+1,MOD(ROWS($1:1)-1,18)+1))

--ron
Ron Rosenfeld - 05 Mar 2008 03:12 GMT
>Hi All,  I have some data in an unfriendly format.  It's organized like this:
>
[quoted text clipped - 17 lines]
>Thanks
>Mike

If the data is all in one cell (e.g. A1), and if the "defining characteristic"
is that it is in three-character groups that need to be split out, then

A2:    =MID(SUBSTITUTE($A$1,CHAR(10),""),(ROWS($1:1)-1)*3+1,3)

and then fill down as far as required.

If the data setup and/or requirements are different, you'll have to be more
specific.
--ron

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.