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
John DarbyPMAsked:
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.

Saurabh Singh TeotiaCommented:
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

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
Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
Did you press Ctrl+Shift+Return after editing the formula instead of Return?
0
John DarbyPMAuthor Commented:
Wow, Ctrl+Shift+Return did it; brief question: why does that work? :)
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Phillip BurtonDirector, 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
Saurabh Singh TeotiaCommented:
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
John DarbyPMAuthor Commented:
Thank you, gentlemen!
0
FarWestCommented:
maybe this is a behavior change in excel, due to it is not a documented way
try this instead
=SUM(IF(FREQUENCY(MATCH(C4:C27,C4:C27,0),MATCH(C4:C27,C4:C27,0))>0,1))

Open in new window

0
John DarbyPMAuthor Commented:
Thanks for the formula, FarWest!
0
FarWestCommented:
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.