KutoolsforOffice — One Suite. Five Tools. Get More Done.February Sale: 20% Off

How to copy column based on cell value to another sheet?

AuthorSunLast modified

When working with data distributed across columns with date headers, it's common to need to extract an entire column from one worksheet and copy it to another sheet, but only for the column that matches a specific date value entered elsewhere in your workbook. For example, suppose you have a table in Sheet1 where each column header is a different date, and in Sheet2!A1 you enter a target date. You want to automatically or easily copy the whole column from Sheet1 whose header matches the date in Sheet2!A1, and paste it into Sheet3—as illustrated below. This is a typical challenge when comparing daily metrics, managing schedules, or extracting time-specific data for reports.
copy column based on cell value


Copy column to another sheet based on cell value with formula

Excel's INDEX and MATCH functions provide an efficient way to retrieve an entire column from a source sheet, based on a specific header value referenced in another sheet. This method is especially useful when you need the data to update automatically as the cell value changes, reducing the need for manual adjustments or repetitive copy-pasting.

1. Select the cell in the destination sheet where you want the column values to be pasted. For instance, click on Sheet3!A1. Then input the following formula:

=INDEX(Sheet1!$A1:$E1,MATCH(Sheet2!$A$1,Sheet1!$A$1:$E$1,0))
Press Enter to apply the formula, then drag the fill handle downward as far as needed (usually down the rows corresponding to the data range in Sheet1). You’ll notice that zeros may appear where the data range ends.
enter a formula to copy column based on cell value to another sheet

2. Delete or filter out the resulting zero cells as needed, to clean up your extracted column.

Note: In this formula, Sheet2!A1 is the cell containing the lookup date, while Sheet1!A1:E1 is the range of headers to check. Adjust these references based on your actual data layout and range size. If your data table is larger, expand the range accordingly. Also, if your data contains blank cells, you may see zeros in the output, so consider applying filters or IFERROR logic for cleaner results.

💡 Tip: If you want to quickly select or process cells based on criteria without setting up formulas, try using Kutools for Excel’s Select Specific Cells tool, seen below. This approach allows direct selection and manipulation of matching cells, streamlining the workflow for both regular and occasional users. Free trial available for 30 days. Download here to try it now.

select specific cells by kutools

VBA Code - Automatically copy column to another sheet based on cell value

If you frequently perform this column extraction task or prefer a solution that doesn’t require setting up formulas or manual operations every time the target date changes, you can use a simple VBA macro. This script will identify the column in Sheet1 that matches the date in Sheet2!A1 and copy the entire column directly to Sheet3. This method is ideal for automating repeated workflows or handling dynamic data structures.

Cautions: Always make sure you have saved your work before running macros. Macros cannot be undone, and incorrect references may copy data to unintended locations.

1. Press Alt + F11 to open the Visual Basic for Applications editor. In the VBA window, click Insert > Module, then paste the following code into the blank module:

Sub CopyColumnByDate()
    Dim wsSource As Worksheet
    Dim wsDest As Worksheet
    Dim lookupSheet As Worksheet
    Dim matchDate As Variant
    Dim lastRow As Long
    Dim colNum As Long
    Dim headerRange As Range
    Dim cell As Range
    
    On Error Resume Next
    xTitleId = "KutoolsforExcel"
    
    Set wsSource = Worksheets("Sheet1")
    Set wsDest = Worksheets("Sheet3")
    Set lookupSheet = Worksheets("Sheet2")
    matchDate = lookupSheet.Range("A1").Value
    
    Set headerRange = wsSource.Range(wsSource.Cells(1, 1), wsSource.Cells(1, wsSource.Cells(1, wsSource.Columns.Count).End(xlToLeft).Column))
    colNum = 0
    
    For Each cell In headerRange
        If cell.Value = matchDate Then
            colNum = cell.Column
            Exit For
        End If
    Next cell
    
    If colNum > 0 Then
        lastRow = wsSource.Cells(wsSource.Rows.Count, colNum).End(xlUp).Row
        wsDest.Range("A1").Resize(lastRow, 1).Value = wsSource.Range(wsSource.Cells(1, colNum), wsSource.Cells(lastRow, colNum)).Value
        MsgBox "Data copied to Sheet3 column A!", vbInformation, "KutoolsforExcel"
    Else
        MsgBox "No matching header found.", vbExclamation, "KutoolsforExcel"
    End If
End Sub

2. Close the VBA editor. In Excel, press Alt + F8, select CopyColumnByDate, then click Run. Your data from the matched date column in Sheet1 will be copied into column A of Sheet3.

Tip: If your headers start in a row other than row1, adjust the row references in the code. If you want the data to be pasted into a different starting column, change Range("A1") accordingly. If the same macro is used often, consider assigning it to a button for easier access.

Possible errors: If you receive a "No matching header found" message, check that the date in Sheet2!A1 exactly matches the date format in the header row of Sheet1.


Other Built-in Excel Methods - Use Filter to isolate and copy column

Excel’s built-in Filter feature can also help isolate and copy a column when you don’t want to use formulas or macros. This manual method is effective for occasional one-off tasks or for users who aren’t comfortable with functions or scripting.

1. Go to Sheet1 and select the header row (for example, row1). Click Data > Filter to add filter dropdowns to each header.

2. Click the filter dropdown arrow in the header row and deselect all columns except the date matching Sheet2!A1. If there are many dates, you can use the search box in the filter menu to quickly find the date value.

3. Select the visible column beneath the matching header. Press Ctrl + C to copy.

4. Go to Sheet3 and click into your preferred starting cell (e.g., A1), then press Ctrl + V to paste.

Notes: The Filter method is entirely manual and does not update automatically if the date changes in Sheet2!A1. This approach is suitable for ad-hoc data extractions and quick reviews where automation is not necessary.

Advantages: No formulas or coding required; simple for quick, visual tasks.
Disadvantages: Labor-intensive if repeated frequently; error-prone if not careful when selecting columns.

a screenshot of kutools for excel ai

Unlock Excel Magic with Kutools AI

  • Smart Execution: Perform cell operations, analyze data, and create charts—all driven by simple commands.
  • Custom Formulas: Generate tailored formulas to streamline your workflows.
  • VBA Coding: Write and implement VBA code effortlessly.
  • Formula Interpretation: Understand complex formulas with ease.
  • Text Translation: Break language barriers within your spreadsheets.
Enhance your Excel capabilities with AI-powered tools. Download Now and experience efficiency like never before!

Best Office Productivity Tools

🤖Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |  Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |  Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

All Kutools add-ins. One installer

Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.

ExcelWordOutlookTabsPowerPoint
  • All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
  • One installer, one license — set up in minutes (MSI-ready)
  • Works better together — streamlined productivity across Office apps
  • 30-day full-featured trial — no registration, no credit card
  • Best value — save vs buying individual add-in