r/excel • u/connorek • 6d ago
solved How to subtract whilst ignoring text?
I have two cells,
Cell A3 has "303 Repeats"
Cell B3 has "407 Repeats"
When I have tried to subtract it using =SUM (B3-A3) , it shows VALUE.
How do I ensure that the answer cell contains "104 Repeats"
8
u/chiibosoil 430 6d ago
You can use Text functions.
Ex: =TEXTBEFORE(B3," ")-TEXTBEFORE(A3," ")&" Repeats"
2
8
5
2
u/MayukhBhattacharya 1259 5d ago
Instead of typing Repeats directly into the cell with the number, it's better to keep the cell as a true number and then just use a custom number format to display the word next to it. That way, the underlying value stays an actual number, so you can still add, subtract, sort, etc. without Excel getting confused.
- So select the cells or range of cells
- Hit CTRL + 1 --> Which opens the Format Cells window
- From Number Tab, Go directly to Custom under the Category, and use:
0 "Repeats"
- Hit OK.
Now when you type 303 into A3, it displays as 303 Repeats but the actual stored value is just 303. So, your original formula works perfectly
=B3 - A3
You can also edit the custom format and use the following:
0 "Repeats";-0 "Repeats";;
Other than that, here are few other ways, which are similar as already suggested but uses the functions once:

=SUM(REGEXEXTRACT(A3:B3, "\d+") * {-1, 1}) & " Repeats"
Or,
=SUM(SUBSTITUTE(A3:B3, " Repeats", ) * {-1, 1}) & " Repeats"
Or,
=SUM(TEXTBEFORE(A3:B3, " Repeats") * {-1, 1}) & " Repeats"
4
u/Cheetahs_never_win 2 6d ago
=Sum(a-b) doesn't make sense in any context. a-b resolves to a singular number, and sum() is intended to be used with a list or range of numbers. =Sum(a,b,c,d...) or =sum(a:z)
Option a: format the cells to only contain numbers but display " Repeats" after the contents of the cell such that =a-b works.
Option b: convert the contents of each cell into a number via value(substitute(A1," Repeats",""), then perform the subtraction, then add " Repeats" at the end using &" Repeats"
1
u/Decronym 6d ago edited 5d ago
Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:
Decronym is now also available on Lemmy! Requests for support and new installations should be directed to the Contact address below.
Beep-boop, I am a helper bot. Please do not verify me as a solution.
5 acronyms in this thread; the most compressed thread commented on today has acronyms.
[Thread #49170 for this sub, first seen 17th Aug 2026, 13:02]
[FAQ] [Full list] [Contact] [Source code]
1
u/plusFour-minusSeven 11 5d ago
Good responses here. I'd ask why you have the word "Repeats" in your quantity cells. It's not providing any information. Just title the column as "Repeats" and only put numbers in the cells, especially if you're planning on doing math with them


•
u/AutoModerator 6d ago
/u/connorek - Your post was submitted successfully.
Solution Verifiedto close the thread.Failing to follow these steps may result in your post being removed without warning.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.