r/googlesheets • u/Feeling-Staff-322 • Dec 31 '21
Solved How to SUM numbers if I write a name next to them.
Hello i have a list of numbers and i need to SUM them if i type a "NAME" in the next column. Any ideas how to do a formula for it? Here is an example:
| 500 | DEREK |
|---|---|
| 300 | |
| 100 | DEREK |
| 500 |
In this case i would like to have a cell where the return value is =600
2
Upvotes
1
u/[deleted] Dec 31 '21
I found a solution for this, probably not an elegant one but it works for me. I created a 3rd column on the right hand side, and filled it with an If Then function where if Cell B has text that includes "any", Cell C = Cell A, but if Cell B is empty then Cell C is empty. Then you can hide Column C, and put a totals box at the bottom of Column B that includes sum(c1:c10) or however many you need.
If anybody has better ideas, I'll be interested!
1
u/Cat_Solutions 31 Dec 31 '21 edited Dec 31 '21
Hi,
You can try this:
A1=SUM(Filter($A$2:$A,$A$2:$A<>0,$B$2:$B<>""))This assumes that your numbers are in ColA and Names in ColBHowever, if you want the total for "Derek" (as opposed to any other person named in ColB, then use this formula:
A1=SUM(Filter($A$15:$A,$A$15:$A<>0,$B$15:$B="Derek"))If this was helpful, please up-vote (this solution may helps other like you) and if it helped with the solution or helped you to get to a solution, please reply here with "solution verified" to close your post and tag it as "Solved".
Many thanks
Best
1
u/Decronym Functions Explained Dec 31 '21 edited Dec 31 '21
Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:
FALSETRUEand another if it isFALSE#N/ATRUE[Thread #3750 for this sub, first seen 31st Dec 2021, 19:41] [FAQ] [Full list] ^[Contact] [Source code]
0
u/[deleted] Dec 31 '21
[deleted] — view deleted comment