Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Transpose random length series of cells

Yes, each grouping is together 1.2101R, 10.1101G, etc. in column A,
and the year is in column B in sequential order. Ultimately, what I
need is for the results to be in one cell with some formatting. For
example, results for 1.2101R in C1 (shown in quotes): "1992 , 1993 ,
1994 , 1995" with the spacing and commas.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default Transpose random length series of cells

Okay, it looks like you now want the quoted string of comma separated years
in Column C next to (I'm guessing) the first occurrence of each of the
grouped data (so the output will be place in C1, C5 and C7 for your example
code). If that is correct, then the following macro should do what you
want...

Sub GroupData()
Dim X As Long
Dim LastRow As Long
Dim Data As String
Dim Dates As String
Dim Cel As Range
'
Const SheetName As String = "Sheet9"
Const DataStartRow As Long = 1
'
With Worksheets(SheetName)
Set Cel = .Cells(DataStartRow, "A")
Data = Cel.Value
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For X = DataStartRow To LastRow + 1
If Data < .Cells(X, "A").Value Then
Cel.Offset(, 2).Value = """" & Left(Dates, Len(Dates) - 3) & """"
Set Cel = .Cells(X, "A")
Data = Cel.Value
Dates = ""
End If
Dates = Dates & .Cells(X, "B").Value & " , "
Next
End With
End Sub

To implement this code, press Alt+F11 to get into the Visual Basic editor,
click Insert/Module on its menu bar and copy/paste the above code into the
code window that opened. Once you have done that, edit the two separated
Const statements changing my example worksheet name from Sheet9 to the
actual name of the worksheet with your data on it and changing the data
start row from 1 to whatever row your data actually starts on. Now, go back
to the worksheet and press Alt+F8, select GroupData from the list and click
the Run button. You say you have 60,000 rows of data, so I'm guessing the
code will take some time to run (I do not have a feel for how long).

--
Rick (MVP - Excel)


wrote in message
...
Yes, each grouping is together 1.2101R, 10.1101G, etc. in column A,
and the year is in column B in sequential order. Ultimately, what I
need is for the results to be in one cell with some formatting. For
example, results for 1.2101R in C1 (shown in quotes): "1992 , 1993 ,
1994 , 1995" with the spacing and commas.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Transpose random length series of cells

Rick: That worked fabulously! Ironically, it also highlighted some
quirks in my dataset. Most of the time my data only has one series of
years, but every so often there's more than one series of years.
Here's an example with the results of your VB code in column C

Col A Col B Col C
11.7102R 1979 "1979 , 1980 , 1981 , 1982 , 1983 , 1984 , 1985"
11.7102R 1980
11.7102R 1981
11.7102R 1982
11.7102R 1983
11.7102R 1984
11.7102R 1985
12.3101G 1966 "1966 , 1967 , 1968 , 1969 , 1970 , 1971 , 1972 , 1973 ,
1974 , 1975 , 1968 , 1969 , 1970 , 1971 , 1971 , 1972 , 1973 , 1974"
12.3101G 1967
12.3101G 1968
12.3101G 1969
12.3101G 1970
12.3101G 1971
12.3101G 1972
12.3101G 1973
12.3101G 1974
12.3101G 1975
12.3101G 1968
12.3101G 1969
12.3101G 1970
12.3101G 1971
12.3101G 1971
12.3101G 1972
12.3101G 1973
12.3101G 1974

You can see that 11.7102R only has one series of years, but 12.3101g
has three different series of years. I need the years pulled out each
time the series of years starts over. I.e. for 12.3101g 1966 though
75 and 12.3101g for 1968-71 and 12.3101g for 71-74
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Transpose random length series of cells

Also, I just attempted to run it on the entire dataset, and am getting
a "out of memory" error. Any suggestions?


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
Transpose random series of cells [email protected] Excel Worksheet Functions 1 November 16th 08 05:36 PM
Transpose random series of cells [email protected] Excel Worksheet Functions 0 November 15th 08 08:00 PM
Transpose a variable length list into Excel / Access Table Pete New Users to Excel 11 September 13th 06 07:37 PM
Variable series length/range JessK Charts and Charting in Excel 1 March 3rd 06 04:02 AM
Plotting different length series in a chart Big Red Charts and Charting in Excel 2 May 5th 05 02:00 PM


All times are GMT +1. The time now is 06:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"