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

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
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,958
Messages
6,175,633
Members
452,661
Latest member
Nonhle

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