How to Find Duplicate with a Formula in Text String in a Single Column and Copy to Other Column

Abstract: Extract unique duplicate words from a single text string using dynamic array functions in Excel.

Created: 2026-08-22 by

You can identify duplicate words within a single text string by splitting the string into individual components, comparing each component against the rest of the list, and then reassembling only the repeated values. This process requires using dynamic array functions available in modern Excel versions to handle the text manipulation and logical evaluation without relying on complex VBA macros or legacy array formulas.

Understanding the Logic of Text Duplication

The core challenge lies in treating a single cell containing a sentence like "apple banana apple orange" as a collection of separate items rather than a single block of text. To find duplicates, you must first break this string apart. In traditional spreadsheet environments, this was nearly impossible with standard formulas because they lack native iteration capabilities over substrings. However, modern spreadsheet software provides powerful text and array functions that allow us to perform these operations step-by-step. The logic follows three distinct phases: extraction, comparison, and aggregation. First, we extract every word from the source cell. Second, we check if each extracted word appears more than once in that same set of extracted words. Third, we filter out any words that are unique and keep only those that have a count greater than one. Finally, we join these filtered words back into a single string for display in the target column. This approach ensures that you get a clean list of only the repeated terms, such as "apple" in our example, while ignoring "banana" and "orange". For users seeking deeper insights into data cleaning techniques, it is helpful to understand how text parsing works across different contexts. You might also explore How to Find Duplicate with a Formula in Text String in a Single Column and Copy to Other Column for alternative methods involving helper columns if your version of Excel does not support dynamic arrays.

Step-by-Step Implementation Using Modern Functions

To implement this solution, you need a version of Excel that supports dynamic arrays (Excel 365 or Excel 2021). The primary function used here is TEXTSPLIT, which divides a text string based on a delimiter. We assume your words are separated by spaces. If your data uses commas or other characters, you will adjust the delimiter argument accordingly. Begin by selecting the cell where you want the result to appear. Enter the following formula structure, assuming your original text is in cell A2:
=LET(
    txt, A2,
    words, TEXTSPLIT(txt, " "),
    counts, COUNTIF(words, words),
    dups, FILTER(words, counts > 1),
    UNIQUE(dups)
)
Let's break down how this formula operates. The LET function assigns names to intermediate calculations, making the formula readable and efficient. The variable txt holds the original text. The variable words creates an array of individual words by splitting txt at every space. The variable counts uses COUNTIF to evaluate each word in the words array against the entire words array, returning an array of numbers representing how many times each word appears. The critical step is the FILTER function. It takes the words array and keeps only those elements where the corresponding value in counts is greater than 1. This effectively isolates the duplicates. However, if a word appears three times, FILTER will return it three times. To present a clean list of unique duplicate words, we wrap the result in the UNIQUE function. This final step removes redundant entries from the output array. If you need to preserve the order of appearance or handle case sensitivity issues, you may need to add additional layers of processing using LOWER or UPPER functions before splitting the text. For instance, changing A2 to LOWER(A2) ensures that "Apple" and "apple" are treated as the same word.

Handling Punctuation and Special Characters

Real-world data often contains punctuation attached to words, such as "apple," or "banana!". The basic TEXTSPLIT approach above will treat "apple," and "apple" as different strings. To fix this, you should preprocess the text to remove or replace punctuation marks. You can use the SUBSTITUTE function to replace common punctuation with empty strings or spaces before applying TEXTSPLIT. For example, you might modify the txt variable definition to include a cleaning step:
cleanTxt, SUBSTITUTE(SUBSTITUTE(A2, ",", ""), ".", "")
This nested substitution removes commas and periods. You can extend this chain to handle exclamation marks, question marks, and other delimiters. Once the text is cleaned, the splitting and counting logic remains identical. This preprocessing step is crucial for accuracy, as even a single stray character can prevent a match.

Alternative Approaches for Legacy Systems

If you are using an older version of Excel that lacks TEXTSPLIT and LET, you cannot achieve this result with a single formula in the target cell. Instead, you must use a multi-step helper column approach. Create a new column adjacent to your data and use TRIM, MID, and SEARCH functions to manually iterate through each word. This method is significantly more complex and prone to errors, as it requires copying formulas down for every possible word length in your longest string. Another alternative is using Power Query, which offers robust text-splitting capabilities through its user interface. You can split the column by delimiter, group by the word, count the occurrences, filter for counts greater than one, and then group again to concatenate the results. While this requires more clicks than a formula, it is highly reliable and does not depend on volatile array calculations. For technical enthusiasts who prefer scripting, PowerShell offers advanced text processing capabilities. If you are dealing with massive datasets outside of Excel, you might consider automating the process using How can I directly negate options in PowerShell? to streamline your data pipeline, although this moves away from spreadsheet-based solutions entirely.

Troubleshooting Common Errors

When implementing this formula, you may encounter a few common issues. The most frequent error is the #SPILL! error. This occurs when there is not enough contiguous blank space in your worksheet for the formula to output its results. Dynamic arrays expand vertically, so ensure that the cells below your formula are empty. Another potential issue is incorrect delimiter specification. If your text uses tabs or multiple spaces between words, TEXTSPLIT might create empty entries in your array. You can mitigate this by using TRIM on the resulting words array or by specifying the exact delimiter character if it is consistent. Additionally, always verify that your data does not contain line breaks, which can interfere with space-based splitting. Use SUBSTITUTE to replace line breaks with spaces if necessary. By following these steps and understanding the underlying logic, you can reliably extract duplicate words from any text string using modern spreadsheet functions. This method is scalable, accurate, and requires no programming knowledge beyond basic formula syntax.

Frequently Asked Questions

Can I find duplicates across multiple columns instead of one?

Yes, but you would need to concatenate the columns first or use a more complex array reference. You can combine all relevant cells into a single string using CONCATENATE or the & operator before applying the splitting logic. Alternatively, you can transpose the range into a single vertical array using TRANSPOSE if your version supports it.

What if my text string has no spaces between words?

If there are no delimiters, TEXTSPLIT will treat the entire string as a single item, making duplication detection impossible unless you define a fixed character width. In such cases, you must insert delimiters manually or use regular expressions via VBA. Standard formulaic approaches rely on whitespace or specific punctuation to separate tokens.

Does this formula work in Google Sheets?

Google Sheets supports similar dynamic array functions, including TEXTSPLIT, LET, and FILTER. The syntax is largely identical, so you can copy the formula directly. However, always check your sheet settings to ensure that experimental features are enabled if you encounter compatibility issues with newer functions.

How do I ignore case sensitivity in the comparison?

To ignore case, wrap your text input in the LOWER function before splitting. For example, change A2 to LOWER(A2) in the LET definition. This converts all text to lowercase, ensuring that "Apple" and "apple" are recognized as the same word during the counting phase.

Why am I getting empty strings in my result?

Empty strings usually result from multiple consecutive spaces in the source text being treated as delimiters. Use the TRIM function on the original text to collapse multiple spaces into single spaces before splitting. This ensures that each element in the resulting array represents a valid word.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More