

TOCOL is one of those quiet functions that unlocks real leverage. In Excel it takes any two‑dimensional range—campaign by channel, product by region, rep by month—and spills it into a single clean column. That one column is much easier to filter, sort, de‑duplicate, score, and feed into your models or dashboards. In Google Sheets, you can mirror the same pattern with FLATTEN and array formulas, so every pivot table, report, or revenue forecast starts from a tidy, linear dataset instead of a maze of cross‑tabs.Where this really compounds is when an AI computer agent sits on top of the workflow. Instead of you copying ranges, rewriting TOCOL formulas, and fixing #VALUE! errors, the agent can open Excel or Sheets, apply TOCOL (or the equivalent), normalize data, rerun UNIQUE and SORT, and log what changed. You move from remembering formulas to simply asking: Every morning, flatten yesterday’s exports and update my master lead list.
If you work in sales, marketing, or at an agency, you live in spreadsheets. Campaigns by channel, territories by rep, SKUs by region – everything ends up in a grid. The problem is that most tools downstream (CRMs, BI tools, AI models) want clean, single‑column lists. That’s exactly what Excel’s TOCOL function – and TOCOL‑style patterns in Google Sheets – are for.Below are three layers of sophistication: from manual, to no‑code, to fully agentic automation.### 1. Manual ways to flatten data with TOCOL#### 1.1 Basic TOCOL in ExcelUse this when you have a tidy 2D range and just need it stacked into one column.1. Open your Excel workbook and identify the 2D range (for example, A2:D10 with campaigns as columns and weeks as rows).2. Click a blank cell where you want the stacked list to start (say, F2).3. Enter: =TOCOL(A2:D10) 4. Press Enter. Excel will spill a single column of values starting in F2.5. If you want to ignore true blank cells, use: =TOCOL(A2:D10,1)6. To read by column instead of by row, use: =TOCOL(A2:D10,1,TRUE)Microsoft’s official TOCOL documentation is at:https://support.microsoft.com/en-us/office/tocol-function-22839d9b-0b55-4fc1-b4e6-2761f8f122ed#### 1.2 Cleaning blanks and errorsTOCOL has an `ignore` argument:- 0 – keep everything (default)- 1 – ignore blanks- 2 – ignore errors- 3 – ignore blanks and errorsExample for a messy export with errors:=TOCOL(A2:D500,3)This flattens your range into a single column and silently skips empty cells and error values (like #N/A) so you get a clean list.#### 1.3 Combining TOCOL with UNIQUE and SORTFor deduplicated, ordered lists:=UNIQUE(SORT(TOCOL(A2:D500,3)))This pattern is perfect for creating unique lead lists from multiple campaigns, consolidated product catalogs, or normalized UTM parameter sets.If UNIQUE doesn’t seem to work after TOCOL (a common edge case), normalize the data first:=LET(t,TOCOL(A2:D500,1), n,FILTER(VALUE(t),t<>""), UNIQUE(SORT(n)))This coerces text numbers to real numbers and drops pseudo‑blanks before deduping.#### 1.4 Google Sheets manual equivalent (FLATTEN pattern)Google Sheets doesn’t have TOCOL (yet), but you can get similar behavior using FLATTEN and array formulas.1. Put each source range in an array literal: =FLATTEN({A2:D10;F2:I10})2. Wrap with UNIQUE or SORT as needed: =UNIQUE(SORT(FLATTEN({A2:D10;F2:I10})))See Google’s official function reference here:https://support.google.com/docs/table/25273This gives you a single, stacked column you can use across dashboards and pivot tables.#### 1.5 Copy–paste values for static snapshotsOnce TOCOL has spilled your list:1. Select the spilled range.2. Press Ctrl+C (Cmd+C on Mac).3. Right‑click where you want a static snapshot.4. Choose Paste Special → Values.This is useful for one‑off analyses, list handoffs to SDRs, or importing into tools that don’t support dynamic arrays.### 2. No‑code methods with automation toolsOnce you’ve got repeatable patterns, you don’t want to be the one opening files every day. Here’s how to offload the busywork without writing code.#### 2.1 Excel + Power AutomateFor Microsoft 365 users, Power Automate can run your TOCOL‑based flows on a schedule.Typical pattern:1. Create an Excel file in OneDrive or SharePoint with: - A raw data sheet (where CSVs or form responses land). - A “Cleaned” sheet with a TOCOL formula referencing the raw sheet.2. In Power Automate, create a cloud flow: - Trigger: Recurrence (e.g., every morning at 7:00 AM). - Action: Get file content for your workbook. - Action: Refresh workbook or “Run script” if you’re using Office Scripts.3. Ensure the workbook recalculates and TOCOL spills the updated list.4. Add downstream actions (e.g., push the cleaned TOCOL output to SharePoint lists, Dynamics, or your CRM).Reference on dynamic arrays and spilled ranges:https://support.microsoft.com/en-us/office/dynamic-array-formulas-and-spilled-array-behavior-64e5c57e-11c3-4b99-b5f2-ef20c45c0b68#### 2.2 Google Sheets + Apps Script / triggers (low‑code)Even if you’re not an engineer, a simple Apps Script can help refresh TOCOL‑style FLATTEN formulas.1. Store your raw exports in one sheet (e.g., “Raw_Leads”).2. In “Flattened_Leads”, use: =UNIQUE(SORT(FLATTEN({Raw_Leads!A2:D;Raw_Leads!F2:I})))3. In Extensions → Apps Script, add a tiny script that just opens and recalculates the sheet, or triggers whatever light data prep you need.4. Add a time‑driven trigger (e.g., hourly) so your flattened list is always fresh.Official Apps Script docs:https://developers.google.com/apps-script#### 2.3 Zapier/Make syncing into a “flat list” sheetNo‑code integration tools like Zapier or Make can:- Listen to new rows in various Sheets or Excel files.- Append them into a master “Flat_List” sheet that already has your TOCOL/FLATTEN logic.- Notify a channel (Slack, email) when the list updates.You’re still relying on spreadsheet formulas, but the ingestion of raw data is automated.### 3. Scaling TOCOL with an AI agent (Simular)At some point, your workflows cross from simple to messy: multiple files, different layouts by client, dozens of little corrections that no formula or static integration fully captures. This is where an AI computer agent like Simular shines.Simular Pro is a production‑grade computer‑use agent that can operate your entire desktop environment: open files, click through dialogs, type formulas, and integrate with browser‑based tools. Instead of you being the “glue” between exports and models, the agent becomes the glue.#### 3.1 Agent pattern: daily lead‑list normalizationStory: Every night, your SDR manager drops CSVs from three ad platforms into a folder. You used to:- Open each CSV in Excel.- Paste into your “Raw” sheet.- Update TOCOL formulas.- Fix errors and blanks.- Export a clean list for the team.With Simular:1. You record or describe the flow once: - Open the folder. - For each new CSV, insert into the “Raw” sheet. - Ensure the TOCOL formula (or FLATTEN pattern in Sheets) references the full range. - Copy the cleaned, deduped TOCOL output into “Leads_Final”.2. The Simular agent replays and improves this process autonomously every day.3. Because every action is logged and inspectable, you can tweak the workflow when layouts change.Pros:- Handles multi‑step, multi‑app workflows across Excel, Google Sheets, email, and browsers.- Production‑grade reliability: suitable for high‑volume sales and marketing ops.- Transparent execution: every click and formula is auditable.Cons:- Requires an initial investment of time to design a robust workflow.- Best suited when the process is repeated frequently (daily/weekly) and touches multiple tools.#### 3.2 Agent pattern: agency reporting at client scaleFor agencies juggling dozens of clients, each with their own report templates:1. Store client‑specific report templates in Excel or Sheets.2. Use TOCOL (or FLATTEN) inside each template to normalize multi‑tab data.3. In Simular, define a playbook: - For each client, open the right template. - Pull the latest platform exports (via browser, API dashboards, or emailed attachments). - Paste into the “Raw” areas. - Let TOCOL‑based formulas recalc. - Export PDFs or share links back to the client.Pros:- Massive time savings for account managers.- Consistent, repeatable output with fewer human errors.Cons:- You must clearly document edge cases (e.g., missing columns) for the agent.By combining strong spreadsheet patterns (TOCOL, UNIQUE, SORT, FLATTEN) with a desktop‑class AI computer agent, you move from “I have to remember how to clean this data” to “The system cleans it, I just review the story it tells.”
In modern Excel (Microsoft 365, Excel 2021+), the easiest way to flatten any rectangular range is with the TOCOL function.1. Identify your source range, e.g., A2:D20 with campaigns as columns and dates as rows.2. Choose an empty cell where you want the flattened list to begin, such as F2.3. Enter: =TOCOL(A2:D20)4. Press Enter. Excel will spill all values from A2:D20 into a single column starting at F2, reading by row from left to right.5. To ignore blank cells, use the ignore argument: =TOCOL(A2:D20,1)6. To read by columns (top to bottom down A, then B, etc.), set scan_by_column to TRUE: =TOCOL(A2:D20,1,TRUE)You can then wrap this TOCOL output with functions like UNIQUE, SORT, or FILTER to build clean lead lists or product catalogs. See Microsoft’s official TOCOL help for more detail: https://support.microsoft.com/en-us/office/tocol-function-22839d9b-0b55-4fc1-b4e6-2761f8f122ed
TOCOL has a built‑in ignore parameter that lets you skip blanks, errors, or both as you flatten a range.The syntax is:=TOCOL(array, ignore, scan_by_column)Where ignore can be:- 0 – keep all values (default)- 1 – ignore blanks- 2 – ignore errors- 3 – ignore blanks and errorsExample: say A2:D500 contains exports from multiple tools, with occasional #N/A errors and empty cells. To flatten this into a clean list:1. Click a blank output cell, e.g., G2.2. Enter: =TOCOL(A2:D500,3)3. Press Enter. Excel spills one column with all non‑blank, non‑error values.If you still see unexpected results, check that cells are truly empty (not "" returned by formulas) and that numeric text is coerced properly. You can combine TOCOL with VALUE and FILTER if needed:=LET(t,TOCOL(A2:D500,1), n,FILTER(VALUE(t),t<>""), n)This sequence first ignores blanks, then converts text numbers and removes pseudo‑blanks before you do further analysis.
If UNIQUE doesn’t seem to remove duplicates after TOCOL, it’s usually because the values aren’t truly identical from Excel’s point of view.Common issues:1. Text vs number: "10" (text) and 10 (number) are different.2. Hidden characters: trailing spaces or non‑printing characters.3. Pseudo‑blanks: formulas returning "" that TOCOL doesn’t treat as a real blank.A robust pattern is to normalize your TOCOL output before calling UNIQUE. For example:=LET( t,TOCOL(A2:D500,1), n,FILTER(VALUE(TRIM(t)),t<>""), UNIQUE(SORT(n)))This does three things:- TOCOL flattens and ignores true blanks.- TRIM removes leading/trailing spaces.- VALUE coerces numeric text into real numbers.Finally, UNIQUE and SORT deduplicate and order the clean list.If you’re still stuck, test on a smaller subset and use LEN() or CODE() on suspicious entries to reveal hidden characters. Microsoft’s TOCOL and dynamic array docs provide additional troubleshooting context.
Google Sheets doesn’t have a native TOCOL function yet, but you can achieve the same "flatten to a single column" behavior with FLATTEN, array literals, and sometimes ARRAYFORMULA.The simplest pattern:1. Suppose your data lives in A2:D10.2. In a blank cell, enter: =FLATTEN(A2:D10)This stacks the 2D range into a single column, reading row by row.If your data is spread across multiple ranges or sheets, wrap them in an array literal first:=FLATTEN({Sheet1!A2:D10;Sheet2!A2:D10})You can then combine this with UNIQUE and SORT for clean lists:=UNIQUE(SORT(FLATTEN({Sheet1!A2:D10;Sheet2!A2:D10})))For more on functions and array behavior in Google Sheets, see the official function index:https://support.google.com/docs/table/25273This gives you TOCOL‑style workflows in Sheets that align nicely with the way you’d model data in Excel.
To automate TOCOL‑style cleanup with an AI agent, think in terms of a repeatable desktop workflow and then let the agent perform it for you.With a computer‑use agent like Simular:1. Define the process: - Where raw files arrive (download folder, email, shared drive). - Which Excel or Google Sheets workbook to open. - Which ranges should be flattened with TOCOL (Excel) or FLATTEN (Sheets). - What post‑processing you need (UNIQUE, SORT, filters). - Where the final, clean list should be saved or exported.2. In Simular Pro, walk the agent through this flow once: opening the file, inserting or updating the TOCOL formula, checking for errors, and saving the results.3. Inspect the transparent execution log to ensure every click and keystroke matches your intent.4. Schedule or trigger the workflow (e.g., whenever a new CSV lands in a folder).The result: your AI agent maintains your flattened, analysis‑ready columns while you focus on strategy, not spreadsheet chores.