Formula to count the number of times a number appears

I have a spreadsheet and need help on a formula. In column A, there are lots of random numbers, many of which repeat. In column B, I am trying to figure out a formula that will count how many different numbers are there. COUNTIF won't work. Please see the attached spreadsheet as an example. Its hard to explain, the spreadsheet will make more sense.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If you could try the following in B2 copied down:

byundtMechanical EngineerCommented:
A somewhat shorter formula that you can use in cell B2 and copy down is:

If your real goal is to count how many different numbers are in column A, then consider:
This formula requires that range A2:A15 not have any blank cells.
Joe RudSystems AdministratorCommented:
I think you might be looking to create a histogram.  Please see if the following tutorial suits your needs.
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

brasimanAuthor Commented:
Thanks for the quick answers, both byundt and the_barman worked great. As i started typing the formula in though. They added one column on me, and its a unique identifier. See the example and it will probably make more sense. I basically need the same thing, but i need the count to start over on every unique ID.
byundtMechanical EngineerCommented:
If you have Excel 2010 or later, you can use the AGGREGATE function:
Put the following formula in C3 (may be copied down):

Alternatively, you can array-enter the following formula in C3:
To array-enter a formula, click in the formula bar, hold Control and Shift keys down, then hit Enter.

With either approach, put a 1 in cell C2.
brasimanAuthor Commented:
Thanks byundt. I tried it and i'm getting the #NAME? error. i checked the formula and its correct. I tried your alternative approach. i am using excel 2003. any thoughts/ideas?
byundtMechanical EngineerCommented:
The IFERROR function requires Excel 2007 or later. That's why you are getting #NAME? error.

For Excel 2003 and earlier, you can copy down a longer array-entered formula in cell C3:

To array-enter a formula, click in the formula bar, hold Control and Shift keys down, then hit Enter. If you see #VALUE! errors when you copy the formula down, then you didn't array-enter the formula.

For future reference, it is always good to specify your software version when you ask an Excel question on Experts Exchange. I've got six different versions of Excel installed on my laptop so I can reproduce what you are seeing and respond appropriately for your version of Excel. Many Askers use the Tags to list their software version.  :-)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brasimanAuthor Commented:
Brad, you're awesome, thank you! That worked. Good point on specifying the version. Makes sense. My bad on that one. Next time i'll make sure I do that. Thanks again for your help!
brasimanAuthor Commented:
Great suggestions and quick responses, thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.