Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Transpose random length series of cells
I have a 60,000 long series of items that correspond with a range of
values. I need to automatically transpose the corresponding values so that they can be combined into one cell. Here's what I have: A B 1.2101R 1992 1.2101R 1993 1.2101R 1994 1.2101R 1995 1.2102G 1986 1.2102G 1987 10.1101G 1963 10.1101G 1964 10.1101G 1965 10.1101G 1966 10.1101G 1967 10.1101G 1968 Here's what I need A B C D E 1.2101R 1992 1993 1994 1995 1.2102G 1986 1987 10.1101G 1963 1964 1965 1966 1967 1968 As you can see there are different quantities with each item. |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Transpose random length series of cells
sheet 1 - has data
In sheet 2 - go to data | filter | advance filter | choose the action: copy to another location | list range : select range A1 : A100 | sheet 2 cell A1 | check unique records only | ok Note : In your range if the header is not specified then your filtered value will as 1.2101R 1.2101R 1.2102G 10.1101G Delete the first value and now in cell B1 ( sheet 2 ) put this formula ( use Ctrl + Shift + Enter ) =IF(ISERROR(INDEX(sheet1!$B$1:$B$20,SMALL(IF(sheet 2!$A1=sheet1!$A$1:$A $20,ROW(sheet1!$A$1:$A$20)),COLUMN(A:A)),0)),"",IN DEX(sheet1!$B$1:$B $20,SMALL(IF(sheet2!$A1=sheet1!$A$1:$A$20,ROW(shee t1!$A$1:$A $20)),COLUMN(A:A)),0)) Once u enter the formula use ctrl + shift + enter Now, select B1 : G20 hit ctrl + r & then ctrl + d You will see the desired result. On Nov 16, 1:06*am, wrote: I have a 60,000 long series of items that correspond with a range of values. *I need to automatically transpose the corresponding values so that they can be combined into one cell. Here's what I have: A * * * * * *B 1.2101R 1992 1.2101R 1993 1.2101R 1994 1.2101R 1995 1.2102G 1986 1.2102G 1987 10.1101G * * * *1963 10.1101G * * * *1964 10.1101G * * * *1965 10.1101G * * * *1966 10.1101G * * * *1967 10.1101G * * * *1968 Here's what I need A * * * * * B * * * C * * D * * *E 1.2101R 1992 1993 1994 1995 1.2102G 1986 1987 10.1101G 1963 1964 1965 1966 1967 1968 As you can see there are different quantities with each item. |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Transpose random length series of cells
|
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Transpose random length series of cells
Is your Column A data grouped by like items as shown (1.2101R grouped
together, 10.1101G grouped together, etc.)? In other words, is it possible for 1.2101R to appear where shown and then again much further down the list? Also, where did you want your results? -- Rick (MVP - Excel) wrote in message ... I have a 60,000 long series of items that correspond with a range of values. I need to automatically transpose the corresponding values so that they can be combined into one cell. Here's what I have: A B 1.2101R 1992 1.2101R 1993 1.2101R 1994 1.2101R 1995 1.2102G 1986 1.2102G 1987 10.1101G 1963 10.1101G 1964 10.1101G 1965 10.1101G 1966 10.1101G 1967 10.1101G 1968 Here's what I need A B C D E 1.2101R 1992 1993 1994 1995 1.2102G 1986 1987 10.1101G 1963 1964 1965 1966 1967 1968 As you can see there are different quantities with each item. |
#5
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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. |
#6
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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. |
#7
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
#8
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Transpose random series of cells | Excel Worksheet Functions | |||
Transpose random series of cells | Excel Worksheet Functions | |||
Transpose a variable length list into Excel / Access Table | New Users to Excel | |||
Variable series length/range | Charts and Charting in Excel | |||
Plotting different length series in a chart | Charts and Charting in Excel |