Countif without CSE, unpredictable behavior

crazykvex

New Member
Joined
Feb 6, 2016
Messages
2
I've stumbled upon a feature of Excel which I do not understand. In the table below I've tried to strip down my issue to its bare essence:

[table="width: 600, class: Grid, align: Left"]
[tr]
[td]X[/td]
[td]COUNTIF(A1,A3:A4) evaluates to: 0[/td]
[td]F9: {1,0} evaluates to: 1[/td]
[td]INDEX(COUNTIF(A1,A3:A4),1,1) evaluates to: 1[/td]

[/tr]
[tr]
[td][/td]
[td]COUNTIF(A1,A3:A4) evaluates to: 0[/td]
[td]F9: {1,0} evaluates to: 1[/td]
[td]INDEX(COUNTIF(A1,A3:A4),1,1) evaluates to: 1[/td]
[/tr]
[tr]
[td]X[/td]
[td]COUNTIF(A1,A3:A4) evaluates to: 1[/td]
[td]F9: {1,0} evaluates to: 1[/td]
[td]INDEX(COUNTIF(A1,A3:A4),1,1) evaluates to: 1[/td]
[/tr]
[tr]
[td]Y[/td]
[td]COUNTIF(A1,A3:A4) evaluates to: 0[/td]
[td]F9: {1,0} evaluates to: 1[/td]
[td]INDEX(COUNTIF(A1,A3:A4),1,1) evaluates to: 1[/td]
[/tr]
[/table]

In the second column, COUNTIF is used to find the values in cells A3:A4 in cell A1 (NOT as an array formula, so no CSE).
The result puzzled me: it was zero, unless the formula is entered on the third line (the same line containing the match).

My main question is
Main Question: what is Excel's evaluation sequence of COUNTIF(A1,A3:A4) and why does it lead to different results based on the row in which the formula is entered?

I also noticed that if I evaluate the formula of each cell separately using F9, the answer is always {1,0}, and after hitting ENTER, the answer is always 1
Bonus Question 1: How can evaluating an equation using F9 change the result?

When the formula is surrounded by INDEX(...,1,1) the problem is solved, a method I stole from Aladin
Bonus Question 2: How does Aladin's workaround solve the row-depencence problem?

Can somebody help me with my (preferably the main!) question?
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Small change on the first post: the INDEX(...,1,1) formulas should be INDEX(...,0,0). Unfortunately I am not allowed to change this in the post itself, that's why I post it separately. Sorry for the confusion.
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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