How to Add Letters to Repeated Date and Amount Values in Excel
Question details
The user wants to create an Excel formula that appends sequential letters (A, B, C, etc.) to transaction records that share identical date and amount values.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- When managing transaction data, identical entries with the same date and amount need unique identifiers generated by appending alphabetical letters based on their occurrence count.
- Observed behavior
- Instead of manually typing letters or counting all transactions on the same date regardless of amount, the user needs a dynamic formula that groups occurrences by both date and amount simultaneously.
Ensure your dataset is organized into columns with headers for Date and Amount, and create a small lookup table on the side that maps occurrence numbers (1, 2, 3...) to corresponding letters (A, B, C...).
Use COUNTIFS and VLOOKUP to Append Letters
Use the COUNTIFS function with an expanding range to count occurrences of matching date and amount combinations, then map the count to a letter using VLOOKUP.
To group transactions by both date and amount, you must use the COUNTIFS function rather than COUNTIF. By using an expanding reference (locking the first cell but not the second), Excel counts how many times the exact combination has appeared up to the current row.
In a separate area of your sheet (e.g., columns I and J), create a table where column I contains numbers 1 through 26, and column J contains letters A through Z.
Assuming Date is in column A (starting A2) and Amount is in column D (starting D2), use the formula =COUNTIFS($A$2:A2,A2,$D$2:D2,D2) in a new column. This establishes a running count for specific date and amount matches.
Wrap your COUNTIFS formula in a VLOOKUP to retrieve the assigned letter from your lookup table: =VLOOKUP(COUNTIFS($A$2:A2,A2,$D$2:D2,D2),$I$2:$J$16,2,TRUE).
Combine the original date and amount with the letter. To only append letters if duplicates exist, use an IF statement: =TEXT(A2,"mm/dd")&"$"&D2&IF(COUNTIFS(A:A,A2,D:D,D2)=1,"","-"&VLOOKUP(COUNTIFS($A$2:A2,A2,$D$2:D2,D2),$I$2:$J$16,2,1)).

Organize Data Seamlessly with WPS Spreadsheet
WPS Spreadsheet offers powerful, built-in formula capabilities including COUNTIFS and VLOOKUP, allowing you to easily manage duplicate entries and automate complex data tagging without writing scripts.
- 1. Open your dataset in WPS: Launch WPS Office and open your transaction spreadsheet containing the duplicate records.
- 2. Apply the COUNTIFS formula: Select the target cell, enter your combination formula using COUNTIFS and VLOOKUP, and press Enter.
- 3. Auto-fill the column: Click and hold the small square at the bottom-right corner of the active cell, and drag it down to apply the letter-appending formula to all remaining rows.

Frequently Asked Questions
Why does my formula output the same letter for every row?
This happens if you do not lock the starting reference in your COUNTIFS range. Make sure your formula is written as $A$2:A2 rather than A2:A2, so the range expands properly as it moves down.
Can I append letters without creating a separate lookup table?
Yes. You can use the CHAR function. For example, =CHAR(64 + COUNTIFS($A$2:A2, A2, $D$2:D2, D2)) will return 'A' for the 1st occurrence, 'B' for the 2nd, and so on, without needing a lookup table.
How can I make the formula ignore transactions that are unique?
You can wrap your formula in an IF statement that checks the total count. By using IF(COUNTIFS(A:A, A2, D:D, D2)=1, "", [Your Formula]), the cell will remain blank for single occurrences and only append letters when duplicates exist.




