JugglerJAF
Active Member
- Joined
- Feb 17, 2002
- Messages
- 297
- Office Version
- 365
- Platform
- Windows
I have a series of numbers, sorted in order, each of which has 6 decimal places. If I use the formula =COUNTIF($A$2:$A$22,"<"&A2) in cell B2 and copy it down, I get sequential values of 0 to 20 as expected (the first row returning zero as there are no numbers smaller than it in the range, the second returning 1 because there's 1 smaller number and so on) - so far so good. However...
If I change the "<" operator to ">" and copy the amended formula for all rows, then the results expected should be 20 to 0, and while it starts off ok, it returns an incorrect value for just one row about half way down the column.
B9 and B10 have the expected values of 13, and 12 respectively, but B11 which should return a value of 11, actually returns a value of 12. All other rows then continue correctly from B12 (returning 10) down to B22 (returning 0).
If I use "<" or ">=", then the values calculated are all as expected, but if I use ">" or "<=", then I get the duplicated value on row 11. Strange.
The issue is definitely related to the number of decimal places as it doesn't occur if the numbers are to 5 decimal places, and I've resolved it for now by multiplying my initial numbers by 10 and doing the COUNTIF formula on the amended numbers.
Has anyone else ever encountered an issue like this (I'm running Office 365 on Windows 10)?
The values being used in the calculation and the results I've obtained are as follows if anyone else wants to try on their version of Excel.
If I change the "<" operator to ">" and copy the amended formula for all rows, then the results expected should be 20 to 0, and while it starts off ok, it returns an incorrect value for just one row about half way down the column.
B9 and B10 have the expected values of 13, and 12 respectively, but B11 which should return a value of 11, actually returns a value of 12. All other rows then continue correctly from B12 (returning 10) down to B22 (returning 0).
If I use "<" or ">=", then the values calculated are all as expected, but if I use ">" or "<=", then I get the duplicated value on row 11. Strange.
The issue is definitely related to the number of decimal places as it doesn't occur if the numbers are to 5 decimal places, and I've resolved it for now by multiplying my initial numbers by 10 and doing the COUNTIF formula on the amended numbers.
Has anyone else ever encountered an issue like this (I'm running Office 365 on Windows 10)?
The values being used in the calculation and the results I've obtained are as follows if anyone else wants to try on their version of Excel.
VALUE | COUNTIF < | COUNTIF > | COUNTIF >= | COUNTIF <= |
45481.590407 | 0 | 20 | 21 | 1 |
45481.590408 | 1 | 19 | 20 | 2 |
45988.640245 | 2 | 18 | 19 | 3 |
49580.780656 | 3 | 17 | 18 | 4 |
50326.000078 | 4 | 16 | 17 | 5 |
51611.340030 | 5 | 15 | 16 | 6 |
52895.700222 | 6 | 14 | 15 | 7 |
52938.600221 | 7 | 13 | 14 | 8 |
53109.540663 | 8 | 12 | 13 | 9 |
55135.080724 | 9 | 12 | 12 | 9 |
56952.070111 | 10 | 10 | 11 | 11 |
58068.000156 | 11 | 9 | 10 | 12 |
58068.000287 | 12 | 8 | 9 | 13 |
59701.790365 | 13 | 7 | 8 | 14 |
72409.810070 | 14 | 6 | 7 | 15 |
76462.060432 | 15 | 5 | 6 | 16 |
83019.160635 | 16 | 4 | 5 | 17 |
98144.640182 | 17 | 3 | 4 | 18 |
203366.880139 | 18 | 2 | 3 | 19 |
578508.480601 | 19 | 1 | 2 | 20 |
671661.940753 | 20 | 0 | 1 | 21 |