Changing the format/layout of an excel worksheet

sleepyowl86

New Member
Joined
Aug 26, 2014
Messages
14
I have a worksheet with over 3 months worth of data entry. My coworker claims she can't understand the layout. She wants me to change it from example 1 to example 2. Is there any easy way to do this without re-entering 3 months worth of work?

Example 1

WK#DateAccnt Name
17/9/15MY PLACE
28/6/15MY PLACE
38/13/15MY PLACE
48/20/15MY PLACE

<tbody>
</tbody>

Example 2
Acct NameWk 1Wk 2Wk 3Wk 4
My Place7/9/158/6/158/13/158/20/15

<tbody>
</tbody>

 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Try this:-
Results sheet2
Code:
[COLOR="Navy"]Sub[/COLOR] MG16Sep15
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] oMax [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] Q [COLOR="Navy"]As[/COLOR] Variant
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("C2"), Range("C" & Rows.Count).End(xlUp))
ReDim Ray(1 To Rng.Count, 1 To 2)
n = 1
[COLOR="Navy"]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
    [COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
        [COLOR="Navy"]If[/COLOR] Not .Exists(Dn.Value) [COLOR="Navy"]Then[/COLOR]
            n = n + 1
            Ray(1, 1) = "Account Name"
            Ray(n, 1) = Dn.Value: Ray(n, 2) = Dn.Offset(, -1).Value: Ray(1, 2) = "Wk " & Dn.Offset(, -2).Value
            .Add Dn.Value, Array(n, 2)
        [COLOR="Navy"]Else[/COLOR]
            Q = .Item(Dn.Value)
            Q(1) = Q(1) + 1
            oMax = Application.Max(Q(1), oMax)
            [COLOR="Navy"]If[/COLOR] UBound(Ray, 2) < oMax [COLOR="Navy"]Then[/COLOR] ReDim Preserve Ray(1 To Rng.Count, 1 To Q(1))
            Ray(1, Q(1) - 1) = "Wk " & Q(1) - 2
            Ray(Q(0), Q(1)) = Dn.Offset(, -1): Ray(1, Q(1)) = "Wk " & Dn.Offset(, -2).Value
            .Item(Dn.Value) = Q
        [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR]
[COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]With[/COLOR] Sheets("Sheet2").Range("A1").Resize(n, oMax)
    .Value = Ray
    .Columns.AutoFit
    .Borders.Weight = 2
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]With[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
You could use Index/Match to create the table. I'd stick with your format if it was me though as you'll find it much easier to analyse data entered in a list like that than if it's already in a table format.

Dom
 
Upvote 0
Mick- I had to learn a new skill but that almost worked perfectly. The problem I'm having is its not changing the entire list.


Dom- Thank you, that's what I thought too. But she'll throw a fit til she gets her way
 
Last edited:
Upvote 0
You could also try a Pivot Table:


Excel 2012
ABCDE
3Week Number
4Account1234
5MY PLACE07/09/1508/06/1508/13/1508/20/15
Sheet4


HTH,
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,391
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top