If you have a large list, not confined to apples and oranges, try the Data
-Filter- Advanced Filter facility. ( If you are new the steps to be taken
will be as follows:
i) Ensure that the data range has got titles, say "Fruit" in one column,
"No," in the next and so on
ii) Keep the cursor on the first cell containing data
iii) Click Data -Filter - Advanced Filter - select the first column entirely
containing the names of fruits ( including the column title - "Fruit")
iv) click on "Copy to another location" button and "Unique Records only" box
v) select the first cell of a new location to copy the unique names of the
fruits ( in this case only "Apples" and "Oranges" will appear below the
column title "Fruit")
vi) Then in the cell next to the first fruit name in the filtered list use
the formula suggested by Franz Verga i.e., =SUMIF(A2:A5;C2;B2:B5) --- here
A2:A5 will represent the range of data containing the names of fruits (
without including the title cell), c2 will represent the cell containing the
fruit name i.e., adjacent to the one where you are entering the formula and
B2:B5 will represent the range of data containing the number of fruits (
excluding the cell holding the title "No.").
vii) Using F4 key, make A2:A5 and B2:B5 as absolute addresses with the $
mark. Enter and copy the formula down the filtered range to get the values
for all types of fruits.