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
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
When the formula is surrounded by INDEX(...,1,1) the problem is solved, a method I stole from Aladin
Can somebody help me with my (preferably the main!) question?
[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?