TRUNC function in COUNTIF or COUNTIFS produce error message

Solvap

New Member
Joined
Sep 17, 2015
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hello,

Would you know why the usage of a TRUNC function into COUNTIF our COUNTIFS, as here-after, produce the following error message ?
=COUNTIF(TRUNC($A$2:$A$6),D$1)

1649590114141.png


The range $A$2:$A$6 contains some numbers with decimals and I aim to count how many of them matches the cell D1 that contains only integers. I did found a work-around (with the SUM...), but, still, I'm surprised as I don't see what is wrong with COUNTIF or COUNTIFS. Is it possible that function like COUNTIF can't handle arrays resulting from another function ?

This works =SUM(--(TRUNC($A$2:$A$6)=D$1))
This doesn't work =COUNTIF(TRUNC($A$2:$A$6),D$1)

Thank you in advance for your time.
Solvap
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
All the xxif(s) functions only work on ranges & not arrays.
 
Upvote 0
Solution
Hello Fluff,

Thx for the info, I wasn't aware of that limitation.

Kind regards
Solvap
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top