Article ID: 247311 - Last Review: January 25, 2007 - Revision: 6.3 How to use macros to sort data in multiple columns as one column in ExcelThis article was previously published under Q247311 On This PageSUMMARY Microsoft Excel does not have a built-in method to sort a
newspaper (snaking) column of data. This article contains a sample macro to
sort data that is in a newspaper column format. MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. Built-in sortingIn Microsoft Excel, you usually use the sorting feature to sort a list. A list in Excel is a series of worksheet rows that contain related data, such as an invoice database or a set of client names and phone numbers. You can use a list as a database, in which each row is a record, and the columns are fields. The first row of the list usually has labels for the columns, for example:A1: Q1 B1: Q2 C1: Q3 A2: 10 B2: 2 C2: 4 A3: 14 B3: 18 C3: 9 A4: 7 B4: 17 C4: 12 A5: 1 B5: 13 C5: 5 A6: 11 B6: 8 C6: 16 A7: 3 B7: 6 C7: 15 A1: Q1 B1: Q2 C1: Q3 A2: 1 B2: 13 C2: 5 A3: 3 B3: 6 C3: 15 A4: 7 B4: 17 C4: 12 A5: 10 B5: 2 C5: 4 A6: 11 B6: 8 C6: 16 A7: 14 B7: 18 C7: 9 Sorting a newspaper-style columnNewspaper columns and snaking columns are different terms for the same type of data format. In newspaper columns, the data fills one column and continues at the top of the next column. In this case, your data probably does not have labels for each column, for example:A1: 10 B1: 2 C1: 4 A2: 14 B2: 18 C2: 9 A3: 7 B3: 17 C3: 12 A4: 1 B4: 13 C4: 5 A5: 11 B5: 8 C5: 16 A6: 3 B6: 6 C6: 15 A1: 1 B1: 7 C1: 13 A2: 2 B2: 8 C2: 14 A3: 3 B3: 9 C3: 15 A4: 4 B4: 10 C4: 16 A5: 5 B5: 11 C5: 17 A6: 6 B6: 12 C6: 18
A1: 1 B1: 7 C1: 13 A2: 2 B2: 8 C2: 14 A3: 3 B3: 9 C3: 15 A4: 4 B4: 10 C4: 16 A5: 5 B5: 11 C5: 17 A6: 6 B6: 12 C6: 18 REFERENCESExcel X for Mac and later versionsFor more information about how to sort, click Excel Help on the Help menu, type sorting, click Search, and then click a topic to view it.For more information about how to use the Sort method from the Visual Basic Editor, click Visual Basic Help on the Help menu, type sort method, click Search, and then click to view sort method. Excel 2001 for MacFor more information about how to sort, click the Office Assistant, type sort a list, click Search, and then click a topic to view it.Note If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. For more information about how to use the Sort method from the Visual Basic Editor, click the Office Assistant, type sort method, click Search, and then click to view sort method. | Article Translations
|
Back to the top
