Question:
How can I easily turn a large Excel table into a single-column table using Offset?
Saud A
2009-09-09 01:35:37 UTC
It's a table of prices recorded in specific time intervals, that need to be arranged into a single column for easier application and formulas. It's currently arranged by days (rows) and months (columns) [the daily prices of interest, arranged by month, so there is going to be some differences in the length of each column].

What's the formula, given that the first price starts at cell A5?
Three answers:
Cozmosis
2009-09-09 11:23:35 UTC
Here is a macro that will take all of the data in a selected range of cells and copy it to a column.



To install the macro...

Alt+F11 to open the VBA editor

Select from the VBA menu, Inset\Module

Paste the code below in the edit window.



Back in Excel, select the range of cells you want to copy to one column.

Run the macro Data_to_Column

The macro will prompt you to select a starting cell to copy the data to.



---





Sub Data_to_Column()

Dim rData As Range

Dim r As Range, c As Range

Dim rStart As Range

Dim counter As Integer



Set rData = Selection

On Error Resume Next

Application.DisplayAlerts = False

Set rStart = Application.InputBox( _

Prompt:="Select the 1st cell you want to copy the data to.", _

Title:="Select Output Location", _

Type:=8)

On Error GoTo 0

Application.DisplayAlerts = True

If rStart Is Nothing Then Exit Sub

For Each c In rData.Columns

For Each r In rData.Rows

If Not IsEmpty(Cells(r.Row, c.Column)) Then

rStart.Offset(counter, 0) = Cells(r.Row, c.Column)

counter = counter + 1

End If

Next r: Next c

End Sub
emyle
2016-12-10 21:35:38 UTC
learn out approach obstacles on man or woman cells. They tutor/print purely 1024 characters and shelter 32xxx...returned in enterprise I had that selection memorized. something is 0.5 of sixty 5,536 so 32k of characters. And 32k basically isn't gigantic for a typical replica paste. Or try CONCATENATE like =CONCATENATE(A1:A1000) and that i anticipate that doesn't paintings. I superb replied to warning you it is going to truncate at 32,768 characters.
unnga
2009-09-09 03:44:23 UTC
You need to write a macro for that.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...