One way would be to sort and then sub-total
Or the COUNTIF function if you want the number rather than the total.
You can make a list of unique numbers, say in B from B2 on. Then, in order to count occurrences of each unique number,
in C2 enter: =COUNTIF($A$2:$A$25,B2) [ copy down as far as needed ]
Substitute SUMIF for COUNTIF in the above formula if you want a total per unique number or just enter =COUNTIF($A$2:$A$25,B2)*B2
Note 1. The above would be in accord with Rob's suggested line.
Note 2. You can create the unique list with filtering, although this can also be done by means of formulas.
Aladin
==============
OK, say your target range is A1 to A100. Use the formula:
=SUMIF(A1:A100,whichvalue,A1:A100)
you can use another cell to define the 'whichvalue' or simply put it in the formula.
Rob
Hmmm .... was actually enquiring about how you would find out what all the values were to be summed, but I see Aladin has suggested a way.
(Also, Gianni's suggestion looks good).
I'd use a PivotTable (NT)