How do I get unique values and combine adjacent values?

image

How would I get the values from D and E using A and B with formulas?

Column D needs to be able to pick out unique values, and hopefully be extendable as A grows. A will not necessarily be sorted as well.

Column E needs to add all adjacent values to the value in column D.

Does it absolutely have to be done with formulae? It seems that a Pivot table would be a suitable tool.

3 Likes

Ah of course, I had originally written off a pivot table as the data was much messier previously (over multiple sets of columns) and I didn’t know how to “merge” the columns together. Much appriciated