In excel, what I am trying to do is list the number of occurrences of column B, based on the number from column A. Here is sample data:

A..........B

3..........40

5..........56

2..........23

..........

..........

..........

..........

Example output to column C would be:

**C**

40, 40, 40

56, 56, 56, 56, 56

23, 23

Can a simple excel function accomplish this, or does this need to be a VBA macro? Can someone help me?