How to Xlookup Rearrange Columns in Excel

Learn multiple Excel methods to xlookup rearrange columns with step-by-step examples and practical applications.

excelformulaspreadsheettutorial
11 min read • Last updated: 7/2/2025

How to Xlookup Rearrange Columns in Excel

Why This Task Matters in Excel

Imagine receiving an employee master list from HR with columns ordered as ID ▶ Name ▶ Department ▶ Hire Date, but the dashboard you maintain expects the columns in the order Name ▶ Hire Date ▶ Department. In many organisations, data owners and report designers work in different teams, so column order mismatches are inevitable.

When you merge files, feed Power Query, or create dashboards, rearranging columns manually every week wastes hours and introduces risk. A single mis-sorted column can make an entire model unusable, lead to incorrect analytics, or – worse – expose confidential information in the wrong place.

Dynamic formulas that look up and return multiple fields in any order solve this; you keep the source table intact, but downstream reports automatically receive columns in the required sequence. For finance users, that means pulling Current Year ▶ Prior Year ▶ Variance rather than the source order. For supply-chain analysts, it can mean displaying SKU ▶ Country ▶ Lead Time even if the master list is Country ▶ SKU ▶ Lead Time.

Excel is ideal for this because the latest versions support dynamic arrays, XLOOKUP, CHOOSECOLS, HSTACK, and other tools that let you fetch multiple columns, rearrange them on the fly, and spill the result without helper columns. Mastering the technique reduces manual editing, minimises formula errors, and makes your models robust against future structural changes. Fail to learn it and you will either duplicate data (breaches single-source-of-truth principles) or build fragile formulas that break the moment someone adds a new column to the source table. Knowing how to rearrange lookup columns therefore connects directly to skills such as data normalisation, report automation, and advanced modelling workflows.

Best Excel Approach

The most powerful approach is to combine XLOOKUP’s ability to return multiple columns with CHOOSECOLS (Microsoft 365) or INDEX with a column number array (pre-365). The general logic is:

  1. Use XLOOKUP to fetch the entire matching row (or rows) from the source table.
  2. Immediately pipe that spilled result into a function that re-orders or filters the columns.

This keeps the lookup and re-ordering in a single dynamic formula, which is easier to audit and performs faster than separate helper columns.

Syntax (Microsoft 365):

=CHOOSECOLS(
    XLOOKUP(lookup_value, lookup_array, return_array), 
    desired_col1, desired_col2, desired_col3 …)
  • lookup_value – the value you want to find
  • lookup_array – the column containing lookup_value
  • return_array – the entire data table so the whole row spills
  • desired_col1 … – positions of columns you want in the order you want them returned

Alternative (pre-365, works down to Excel 2010 with Ctrl + Shift + Enter or Excel 2021 as a dynamic array):

=INDEX(
   return_table, 
   MATCH(lookup_value, lookup_column, 0),
   {desired_col1,desired_col2,desired_col3})

Where the array constant inside INDEX specifies the new order.

Use XLOOKUP + CHOOSECOLS whenever you have Microsoft 365/Excel 2021 because it spills automatically, needs no legacy array entry, and is self-documenting. Use INDEX when colleagues are on older versions or CHOOSECOLS is unavailable.

Parameters and Inputs

  • lookup_value – text, number, or date you are matching. Must appear exactly once (or handle duplicates in advanced scenarios).
  • lookup_array – single column range such as [A2:A1000] with consistent data type. Leading/trailing spaces or mismatched formats will break the match.
  • return_array – contiguous range covering all columns you might need in any order. Use structured Table references if possible to remain resistant to added rows.
  • desired_col positions – positive integers (1-n) representing the column order inside return_array, not worksheet column letters.
  • Optional XLOOKUP parameters – if_not_found, match_mode, search_mode. Use if_not_found to return a clear message instead of #N/A.
  • Data preparation – trim spaces, normalise case if case-sensitive matches are required, convert ranges to Tables to allow size expansion.
  • Validation – use Data Validation or COUNTIF to flag duplicate keys. For numeric IDs imported as text, wrap lookup_value in VALUE or ensure both sides are stored as numbers.
  • Edge cases – duplicates (XLOOKUP returns first match), missing values (handle with if_not_found), added columns (use structured Table references so CHOOSECOLS positions stay correct even if physical columns shift).

Step-by-Step Examples

Example 1: Basic Scenario

Suppose Sheet Data contains a Table named tblStaff:

EmployeeIDNameDepartmentHireDate
1001Susan VegaFinance18-Jan-17
1002Raj PatelMarketing02-Mar-16
1003Aki HayashiIT11-Nov-18

Your report sheet needs Name ▶ HireDate ▶ Department in that exact order based on a typed EmployeeID in cell C4.

  1. Click the cell where the three-column result should begin (let’s use D4).
  2. Enter:
=CHOOSECOLS(
  XLOOKUP(C4, tblStaff[EmployeeID], tblStaff), 
  2, 4, 3)
  1. Press Enter. Excel spills three columns wide. For EmployeeID 1002 the output is:
D4 (Name)E4 (HireDate)F4 (Department)
Raj Patel02-Mar-16Marketing

Why it works:

  • XLOOKUP locates row 2 in tblStaff where EmployeeID matches 1002 and spills the entire row [1002, Raj Patel, Marketing, 02-Mar-16].
  • CHOOSECOLS pulls column 2 (Name), column 4 (HireDate), then column 3 (Department), effectively rearranging.

Variations

  • Add if_not_found: XLOOKUP(C4, tblStaff[EmployeeID], tblStaff, "Not on list")
  • Change the order by editing the list inside CHOOSECOLS – for example [4,2,3] to display HireDate first.

Troubleshooting

  • If you see #N/A, confirm C4 exactly matches a value in tblStaff[EmployeeID].
  • If extra spaces exist, wrap both sides in TRIM or clean the source with Power Query.

Example 2: Real-World Application

Scenario: A weekly CSV export named SalesMaster has fields in the order OrderID ▶ Region ▶ SKU ▶ Quantity ▶ SalesValue ▶ OrderDate. Management wants a “Quick Glance” sheet that shows Region ▶ SalesValue ▶ Quantity for a list of 50 OrderIDs typed in column A. The source grows by thousands of rows each week.

Setup

  • Load SalesMaster as an Excel Table called tblSales.
  • In cell B2 type the formula and copy down:
=CHOOSECOLS(
  XLOOKUP(A2, tblSales[OrderID], tblSales, "Missing", 0),
  2, 5, 4)

Walkthrough

  1. XLOOKUP returns the entire row for the matching OrderID. Because we entered the third argument tblSales (whole table), five columns spill to the right of B2.
  2. Immediately CHOOSECOLS filters that spill so only column 2 (Region), column 5 (SalesValue), and column 4 (Quantity) flow out in the exact order management wants.
  3. Fill the formula down 50 rows. Each row operates independently, providing zero-maintenance weekly refresh: simply paste the new CSV over tblSales and all quick-glance data updates.

Business value

  • No copy-paste, no helper columns.
  • Region managers now have their KPIs in column order that matches the regional scorecard without touching raw data.
  • Because tblSales is a Table, adding new columns in the export (for example Currency) does not break the formula – CHOOSECOLS still references by position within the table, not sheet columns.

Performance
XLOOKUP processes 50 matches against tens of thousands of rows in milliseconds. If performance degrades, consider sorting tblSales[OrderID] and using binary search (search_mode = 1) or building a unique index column.

Example 3: Advanced Technique

Goal: Build a dynamic, multi-row lookup that returns an entire department’s staff list but rearranged to Surname ▶ FirstName ▶ Email ▶ Manager. The source Table tblEmployees is in the order EmpID ▶ FirstName ▶ Surname ▶ Email ▶ Department ▶ Manager.

  1. On the Parameters sheet, a dropdown in cell B1 selects a Department name, for example “Finance”.
  2. On the Report sheet, in A3 enter:
=LET(
   dept, Parameters!B1,
   rows, FILTER(tblEmployees, tblEmployees[Department]=dept),
   CHOOSECOLS(rows, 3, 2, 4, 6)
 )

Explanation

  • FILTER extracts all rows where Department equals the parameter.
  • CHOOSECOLS then re-orders the exposed columns: 3 (Surname) ▶ 2 (FirstName) ▶ 4 (Email) ▶ 6 (Manager).
  • LET names dept and rows to avoid recalculating and to make the formula readable.

Edge Handling

  • If the department is mistyped, FILTER returns a blank spill. Wrap in IFERROR to display “No staff found”.
  • To sort by surname add SORT: SORT(CHOOSECOLS(rows,3,2,4,6), 1, 1).

Professional Tips

  • Because the result is dynamic, pivot tables or Power Pivot can reference the spilled range by creating a Linked Table that automatically expands as staff join or leave.
  • For very large HR datasets use TAKE or VSTACK to aggregate departmental lists from multiple divisions.

Tips and Best Practices

  1. Convert source data to Excel Tables (Ctrl + T). Table references expand automatically when rows or columns grow, preventing broken formulas.
  2. Keep lookup_value data types consistent. If IDs sometimes import as text, wrap both lookup_value and lookup_array in TEXT or VALUE as appropriate.
  3. Use LET to store interim results like the spilled row; this enhances readability and improves performance because Excel calculates the spilled range once.
  4. Combine CHOOSECOLS with SELECTCOLUMNS in Power Query for an end-to-end no-code solution that works in refreshable queries.
  5. Document column numbers in a comment or define a named constant like col_Order = [2,5,4] to avoid magic numbers in formulas.
  6. Auditing: Evaluate formulas with F9 in the formula bar to see the spilled array before CHOOSECOLS applies; this speeds up debugging.

Common Mistakes to Avoid

  1. Selecting only a single column as return_array. If you pass tblStaff[Name] instead of entire tblStaff, XLOOKUP cannot spill other columns, so rearranging fails.
  2. Forgetting that CHOOSECOLS positions refer to the return_array, not to the worksheet. New users often miscount and pull the wrong field.
  3. Mixing data types – numeric EmployeeID in lookup_array but text \"1001\" in lookup_value produces #N/A. Coerce both to the same type.
  4. Not handling missing matches. An unhandled #N/A can break downstream formulas. Always use XLOOKUP’s if_not_found argument or wrap the entire expression in IFERROR.
  5. Hard-coding column numbers without comments means future maintainers cannot tell what each number represents; they might delete a source column and silently reorder your output.

Alternative Methods

MethodProsConsBest Use Case
XLOOKUP + CHOOSECOLSDynamic arrays, spill friendly, readableRequires Microsoft 365/2021Modern environments
INDEX + MATCH with array of columnsWorks in older ExcelNeeds legacy Ctrl + Shift + Enter in versions before 2021; less intuitiveMixed-version teams
VLOOKUP with CHOOSESingle formula; backward compatibleCHOOSE gent adds calc overhead; VLOOKUP cannot look leftLegacy models needing quick fix
Power Query re-order columns then mergeGUI driven; zero formulasRequires refresh action; not ideal for single-cell lookupsETL pipelines, data warehouse staging
Helper columns to reorder manuallyTransparent to beginnersTedious, error-prone, bloats worksheetOne-off ad-hoc tasks

When speed and maintainability matter, XLOOKUP + CHOOSECOLS is clearly superior. If you must support Excel 2016 or earlier, INDEX + MATCH with an array constant replicates the behaviour. Power Query is preferable when you also need to join, clean, or shape data as part of a larger ETL process.

FAQ

When should I use this approach?

Use it whenever the presentation order of data differs from the source table order and you need automatic refresh. It shines in dashboards, KPI cards, mail-merge sheets, and any report pulled from a master table.

Can this work across multiple sheets?

Yes. Point lookup_array and return_array to ranges on other sheets or even in closed workbooks (using external references). For example:
XLOOKUP(A2, 'RawData'!B:B, 'RawData'!B:G) then pipe into CHOOSECOLS.

What are the limitations?

  • CHOOSECOLS is Microsoft 365/2021 only.
  • XLOOKUP returns the first match only; duplicates require FILTER.
  • Column numbering is static; if the logical order in the source changes you must update numbers.

How do I handle errors?

Wrap either XLOOKUP or the entire expression in IFERROR or specify the if_not_found argument. Example:
=IFERROR(CHOOSECOLS(XLOOKUP(A2, …),2,4,3), "Check ID").

Does this work in older Excel versions?

INDEX + MATCH with an array constant works back to Excel 2010. You lose spill behaviour (earlier than 365) and must enter as Ctrl + Shift + Enter. CHOOSECOLS is unavailable, so use CHOOSE or construct a horizontal array manually.

What about performance with large datasets?

XLOOKUP is optimised for binary search if the lookup_array is sorted; set search_mode to 1. For millions of rows, consider pushing heavy joins to Power Query or Power Pivot where column selection is cheap and memory efficient.

Conclusion

Rearranging columns during a lookup is a common but often overlooked requirement in real-world reporting. By mastering XLOOKUP combined with CHOOSECOLS (or legacy INDEX techniques) you unlock the ability to keep source data pristine while presenting information exactly how stakeholders expect it. This reduces manual intervention, increases model reliability, and integrates seamlessly with modern dynamic-array workflows. Practise the examples above, experiment with LET, and soon you will be able to reshape any dataset on the fly – a hallmark of advanced Excel proficiency.

We use tracking cookies to understand how you use the product and help us improve it. Please accept cookies to help us improve.