I understand this one...
=if((a5-a4)*24>4,(a5-a4)*24-0.5,(a5-a4)*24)
This one loses me...
=(A5-A4)*24-((A5-A4)*24>4)*0.5
((A5-A4)*24>4) doesn't look like a complete statement.
What did I miss in Algebra 101 ..?
Nothing. Then again, you didn't learn about IF() functions in Algebra
101, either.
An expression like (a>b)*c is programming shorthand for: if(a>b,c,0).
The form (a>b)*c actually works by accident of implementation,
although it has become so common-place, most programmers do not
realize it. The "(a>b)" part is a boolean expression, which results
in TRUE or FALSE. It just so happens that internally, TRUE has a
numerical value of 1, and FALSE has a numerical value of 0. It does
not have to be that way. 40 years ago, I worked with a language where
TRUE is -1; so (a>b)*c would yield surprising results.
Moreover, Excel does not always interpret "(a>b)" as a numerical
expression. It only "converts" the boolean expression to a numerical
expression which it is used in a numerical expression, as above. As a
counter-example:
=if((2>1)=1,true)
results in FALSE. This is why you will see Excel programmers do
strange things (sometimes unnecessarily), such as:
=if(1*(2>1)=1,true)
=if(--(2>1)=1,true)
HTH.