Function Problems

How to Extract Unique Ledger Account Names from Line-Break Text in Excel

Aamir Naveed AkramAamir Naveed Akram Nov 11, 2026 868 views

Question details

The user needs to extract distinct ledger account names from a cell range where each cell contains multiple lines separated by carriage returns, while omitting the final narration line.

How to Extract Unique Ledger Account Names from Line-Break Text
Product
Excel
Device & OS
not provided
Scenario
Cleaning and processing exported accounting data by extracting specific account names dynamically without keeping the transaction narrations.
Observed behavior
Exported data groups multiple ledger entries into single cells with line breaks and a trailing narration line, requiring a dynamic formula to split, filter, and extract the unique names into a list.
Before you start

Ensure you are using a modern spreadsheet version (like Microsoft 365 or the latest WPS Office) that supports dynamic array functions such as LET, UNIQUE, TEXTSPLIT, and VSTACK.

Solution 1Recommended

Use LET, UNIQUE, and TEXTSPLIT Functions

Combine all text, split by carriage returns, and filter out the unwanted narration lines dynamically.

1
Select the destination cell

Click on the cell where you want the extracted list of unique ledger account names to begin spilling.

2
Input the dynamic formula

Enter the following formula into the formula bar: =LET(v,UNIQUE(TEXTSPLIT(TEXTJOIN(CHAR(10),TRUE,VSTACK(B10:B13)),,CHAR(10))),FILTER(v,ISERROR(SEARCH("Bill No",v))))

3
Adjust the references

Change B10:B13 to match your actual data range, and update "Bill No" to the specific text that identifies the final narration line in your accounting software export.

Dynamic Spilling: This formula will automatically spill the unique account names down the column. Make sure there are empty cells below your formula to avoid a #SPILL! error.
Efficient Data Processing with WPS Spreadsheet

Process Complex Accounting Data in WPS Office

WPS Spreadsheet provides powerful dynamic array functions and text manipulation tools to handle multi-line cell data effortlessly. It is an excellent free alternative for complex data cleaning tasks.

  1. 1. Open your data file: Launch WPS Spreadsheet and open the exported accounting ledger.
  2. 2. Apply dynamic formulas: Use modern array functions like UNIQUE and TEXTSPLIT directly in the formula bar to manipulate your data.
  3. 3. Analyze and save: Review the extracted unique accounts and save your workbook in the standard .xlsx format to ensure compatibility.
Seamlessly compatible with Microsoft Excel functions including LET, UNIQUE, and TEXTSPLIT.Handle heavy accounting datasets with fast, lightweight performance.Clean up multi-line cells using built-in text-to-columns and dynamic arrays.
microsoft office alternative - wps office

Frequently Asked Questions

What does CHAR(10) do in these formulas?

CHAR(10) represents a line break (carriage return) in Excel. It is used as the delimiter to tell functions like TEXTSPLIT and TEXTJOIN where one line ends and another begins within the same cell.

Why am I getting a #CALC! error with my formula?

The #CALC! error often occurs if the FILTER function doesn't find any results that meet the criteria, or if you are using an older version of the spreadsheet software that does not support dynamic array formulas.

How can I extract unique values if I don't have Office 365?

If you don't have access to modern functions like TEXTSPLIT, you can use Power Query to split the column by delimiter (choosing line feed), unpivot or append the data into a single column, and then remove duplicates.

Can I filter out multiple different narration markers?

Yes. You can expand the FILTER criteria by using the multiplication operator (*) for 'AND' logic or the addition operator (+) for 'OR' logic within the ISERROR and SEARCH functions.