  asked on

# 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.
Microsoft Excel Last Comment
FarWest

8/22/2022 - Mon
Saurabh Singh Teotia

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
SOLUTION
Phillip Burton

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
John Darby

Wow, Ctrl+Shift+Return did it; brief question: why does that work? :)
Phillip Burton

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.
Saurabh Singh Teotia

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
John Darby

Thank you, gentlemen!
FarWest

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))