MERGECOLUMNS
Description
Merges columns by placing them side by side into a new range.
Syntax
MERGECOLUMNS(
range1
, [
range2
], ...)
- range1: The first range.
- range2: The second range.
Example
Formula | Result |
|---|---|
=MERGECOLUMNS({1,2;3,4},{10,20,30;40,50,60}) | 1 2 10 20 30
3 4 40 50 60
|
Notes
- This function creates a new range by combining all the range arguments. It starts with the first range and then adds the second range on its right side, aligning the top of the new range with the resulting range. This continues for all subsequent ranges. In the resulting range, the number of rows equals the number of rows in the largest range. If a range does not have as many rows as the maximum range, those additional rows are filled with null values. The number of columns in the resulting range equals the sum of the columns in all of the ranges. Duplicate columns are not removed.
- This function is intended for use in array formulas. You submit array formulas with special keyboard shortcuts. We recommend that you use the unconstrained keyboard shortcut Ctrl+Alt+Enter (on Windows) or Command+Option+Enter (on Mac) so Worksheets can use all the cells it needs for the results. For more information, see Reference: Array Formula Keyboard Shortcuts.
Related Functions
REMOVECOLUMNS