Excel formula to covert groups of colums to a single row

Dazza01

New Member
Joined
Nov 5, 2016
Messages
1
I am struggling with a formaula, i have tried a number of different calculations, but cannot seem to figure it out, below is the data table, i would prefer not to use a VBA as i have limited experience.
Kosha.png

What i am trying to achieve is below
Yv5y6.png




 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Dazza01,

Welcome to the MrExcel forum.

You are posting two pictures/images.

This means that if this was a problem where one needed to use your data, anyone trying to help you would have to enter the data manually.


I would like more information. Please see the Forum Use Guidelines in the following link:

http://www.mrexcel.com/forum/board-announcements/127080-guidelines-forum-use.html


See reply #2 at the next link, if you want to show small screenshots, of the raw data, and, what the results should look like.

http://www.mrexcel.com/forum/about-board/508133-attachments.html#post2507729


Or, you can post your workbook/worksheets to the following free site (sensitive data changed), mark the workbook for sharing, and, provide us with a link to your workbook:

https://dropbox.com


If you are not able to provide the above, then:

Click on the Reply to Thread button, and just put the word BUMP in the thread. Then, click on the Post Quick Reply button, and someone else will assist you.
 
Upvote 0
Welcome to the MrExcel board!

See if this is any use. Formula in A7 is copied across and down. You may then need to reformat the first column as date and/or the 4th column as number.

Excel Workbook
ABCDEFGHIJKL
11/01/2016AAA10002/01/2016BBB11003/01/2016CCC1200
24/01/2016DDD13005/01/2016EEE14006/01/2016FFF1500
37/01/2016GGG16008/01/2016HHH17009/01/2016III1800
410/01/2016JJJ190011/01/2016KKK200012/01/2016LLL2010
5
6
71/01/2016AAA1000
82/01/2016BBB1100
93/01/2016CCC1200
104/01/2016DDD1300
115/01/2016EEE1400
126/01/2016FFF1500
137/01/2016GGG1600
148/01/2016HHH1700
159/01/2016III1800
1610/01/2016JJJ1900
1711/01/2016KKK2000
1812/01/2016LLL2010
19
Rearrange
 
Upvote 0
Dazza01,

Here is a macro solution for you to consider, based on your displayed flat text, that will adjust to the number of raw data rows, and, columns, and, that uses two arrays in memory.

Sample raw data in the active worksheet:


Excel 2007
ABCDEFGHIJKLMN
1101/01/2016AAA100002/01/2016BBB110003/01/2016CCC1200
2204/01/2016DDD130005/01/2016EEE140006/01/2016FFF1500
3307/06/2016GGG160008/01/2016HHH170009/01/2016III1800
4410/01/2016JJJ190011/01/2016KKK200012/01/2016LLL2010
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Sheet1


And, after the macro:


Excel 2007
ABCDEFGHIJKLMN
1101/01/2016AAA100002/01/2016BBB110003/01/2016CCC1200
2204/01/2016DDD130005/01/2016EEE140006/01/2016FFF1500
3307/06/2016GGG160008/01/2016HHH170009/01/2016III1800
4410/01/2016JJJ190011/01/2016KKK200012/01/2016LLL2010
5
6DATEF/NL/NVALUE
7101/01/2016AAA1000
8102/01/2016BBB1100
9103/01/2016CCC1200
10204/01/2016DDD1300
11205/01/2016EEE1400
12206/01/2016FFF1500
13307/06/2016GGG1600
14308/01/2016HHH1700
15309/01/2016III1800
16410/01/2016JJJ1900
17411/01/2016KKK2000
18412/01/2016LLL2010
19
Sheet1


Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

1. Copy the below code
2. Open your NEW workbook
3. Press the keys ALT + F11 to open the Visual Basic Editor
4. Press the keys ALT + I to activate the Insert menu
5. Press M to insert a Standard Module
6. Where the cursor is flashing, paste the code
7. Press the keys ALT + Q to exit the Editor, and return to Excel
8. To run the macro from Excel press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.

Code:
Sub ConvertGroups()
' hiker95, 11/06/2016, ME974416
Dim a As Variant, i As Long, c As Long, lr As Long, lur As Long, lc As Long, n As Long
Dim o As Variant, j As Long
Application.ScreenUpdating = False
With ActiveSheet
  lr = .Cells(1, 1).End(xlDown).Row
  lur = .Cells(.Rows.Count, 1).End(xlUp).Row
  If lur > lr Then
    .Rows(lr + 2).Resize(lur).ClearContents
  End If
  lc = .Cells.Find("*", , xlValues, xlWhole, xlByColumns, xlPrevious, False).Column
  a = .Range(.Cells(1, 1), .Cells(lr, lc))
  n = (lr * (lc - 1) / 4) + 1
  ReDim o(1 To n, 1 To 5)
  j = j + 1
  o(j, 1) = "": o(j, 2) = "DATE": o(j, 3) = "F/N"
  o(j, 4) = "L/N": o(j, 5) = "VALUE"
  For i = LBound(a, 1) To UBound(a, 1) Step 1
    For c = 2 To UBound(a, 2) Step 4
      j = j + 1
      o(j, 1) = a(i, 1)
      o(j, 2) = a(i, c)
      o(j, 3) = a(i, c + 1)
      o(j, 4) = a(i, c + 2)
      o(j, 5) = a(i, c + 3)
    Next c
  Next i
  .Cells(lr + 2, 1).Resize(UBound(o, 1), UBound(o, 2)) = o
  .Range("B" & lr + 3 & ":B" & UBound(o, 1) + lr + 3).NumberFormat = "mm/dd/yyyy"
  .Columns(1).Resize(, UBound(o, 2)).AutoFit
End With
Application.ScreenUpdating = True
End Sub

Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm, and, answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.

Then run the ConvertGroups macro.
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,399
Members
449,447
Latest member
M V Arun

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