I am trying to create a Conditional Formatting formula to be applied along two columns comparing HOUR values. As an example I have below three rows of the spreadsheet (the link to the actual spreadsheet is here):
| A | B | C | D |
1 | 14:00 | 02:00 | 12:00 | 12:00 |
2 | 15:30 | 16:30 | 01:00 | 01:00 |
3 | 08:30 | 09:30 | 01:00 | 01:00 |
Step 1: The C column is a result of a subtraction: B - A. Since I am working with Hour values (not Date and Hour nor Date, only Hour) there is a formula that I use on the C column that is:
=(B1-A1) + IF(B1 < A1; 1)
This formula essentially calculates B - A and if B is "smaller" than A (it actually is a timespan from the next day), it adds 1
, otherwise my result would be a negative amount of hours. (More about that here.)
Step 2: The D column is an inserted value (not the result of any formula), and the whole column has the format (Hour).
Step 3: I created a Conditional Formatting rule that compares the values on the C column with the values on the D column. If they are different, the cells on the C column should be painted green:
=C1<>D1 on the interval C1:C1000
Step Problem:
The C1 cell isn't painted, since its value is the same of the D1 (both are 12:00
).
The C2 also isn't painted since its value is the same of the D2 (both are 01:00
).
The C3 is painted even though its value (01:00
) is the same of the D3 (01:00
)!
And that behavior just goes on repeating itself apparently randomly on the spreadsheet.
I've researched a lot about it and even tested it on Excel and found that there it works like a charm. But in Google Spreadsheets I get this strange behavior.