Apr 12 2023 05:16 AM
Hi,
I would need help finding the right function. If I have several names that are repeated many times, and there is a number after all of them, how could I combine these so that the name is repeated only once, and the function would count the sums that were after the repeated names after the name?
Apr 12 2023 05:42 AM
As far as I could gather from the text, you could use two possible methods for this.
Using a pivot table:
Using a formula:
Both methods will give you a list of each unique name with the sum of all the numbers associated with that name.
If this is not what you are looking for, please include the following info to help others answer your question (click on link):
Welcome to your Excel discussion space!
I hope this helps!
I know I don't know anything (Socrates)
Apr 12 2023 06:28 AM - edited Apr 12 2023 06:32 AM
there is no magic function to do this. A formula can be created to do it. For example I just remember i wrote a LAMBDA function that will extract numbers from a string of text so that could be used but is probably over-kill. For example is there a consistent format for the name number combination? Is there always a character like - or : in between or at least a space? What about the names, are they single names Jane-3 or could they be multiple like Jane Doe 5
A sample sheet with example data would make it much easier for to answer the question.
that all said I created a formula to do it based on spaces:
=LET(in, A1:A9,
numbers, TOCOL(--TEXTSPLIT(TEXTJOIN(";",1,TRIM(in)), " ", ";",0,,""),3),
names, TRIM(SUBSTITUTE(in,numbers,"")),
nList, UNIQUE(names),
REDUCE({"names","amt"},nList,LAMBDA(p,q, VSTACK(p,HSTACK(q,SUM(FILTER(numbers,names=q,0)))))))
NOTE: I think Niko above assumed you mean you have names in 1 column and values in the next column. Those solutions above work well for that. I assumed a more difficult problem where the cell is text with both the name and number in it:
Mary 5
Sue Beth 18
see attached.