Excel formula for Counting Unique entries in column

I have a formula which I want to alter to include three more cells in a column, but when I change the formula, I get a division error:

This is the formula: =SUM(1/COUNTIF(C4:C26,C4:C26))
...I want to add 3 more cells, so I modify to this:
=SUM(1/COUNTIF(C4:C29,C4:C29))

The modified formula gives me a division error: #DIV/0!
The odd thing is there are values in all the cells.
LVL 1
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.

Commented:
Quick question..when you enter this formula...

Do you enter this formula by ctrl+shift+enter .. rather then pressing a normal enter since it's an array formula...

However even after that if it gives you an error can you post your workbook since it should give you an error only when you have blank values...
0

Experts Exchange Solution brought to you by

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

Director, Practice Manager and Computing ConsultantCommented:
Did you press Ctrl+Shift+Return after editing the formula instead of Return?
0
PMAuthor Commented:
Wow, Ctrl+Shift+Return did it; brief question: why does that work? :)
0
Director, Practice Manager and Computing ConsultantCommented:
Because your formula is an "array formula", and that's how you have to end it.

If you highlight the cell, you will notice a pair of {} around it. That is the indication that it's an array formula.
0
Commented:
Ctrl+Shift+Enter...

Makes the formula array which means it checks each cell by one in your arrangement and give you an answer,,,

If you notice countif(rng,cell) is not an array formula and it's normally applied on one cell at a time but when you convert it an array it checks your each cell in data and then accordingly give you  an answer...

You can go to formula-->evaluate formula anytime to see how the formula is working...

Here is more definition of array formulas...

https://support.office.com/en-za/article/Guidelines-and-examples-of-array-formulas-7d94a64e-3ff3-4686-9372-ecfd5caa57c7
0
PMAuthor Commented:
Thank you, gentlemen!
0
Commented:
maybe this is a behavior change in excel, due to it is not a documented way
``````=SUM(IF(FREQUENCY(MATCH(C4:C27,C4:C27,0),MATCH(C4:C27,C4:C27,0))>0,1))
``````
0
PMAuthor Commented:
Thanks for the formula, FarWest!
0
Commented:
You are welcome.
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.