IF, THEN and Equations

%3CLINGO-SUB%20id%3D%22lingo-sub-1928995%22%20slang%3D%22en-US%22%3EIF%2C%20THEN%20and%20Equations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1928995%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EI%20am%20looking%20for%20something%20for%20this%20situation%3A%3C%2FP%3E%3CP%3EIF%20the%20result%20of%20the%26nbsp%3B%3CEM%3Eequation%3C%2FEM%3E%20is%20%26gt%3B%208%2C%20THEN%20the%20result%20is%20the%20%3CEM%3Eequation%3C%2FEM%3E%26nbsp%3Bminus%200.5%2C%20or%20ELSE%20it%20will%20just%20equal%20the%20original%26nbsp%3B%3CEM%3Eequation%3C%2FEM%3E.%20Is%20this%20possible%3F%20Is%20it%20possible%20with%20the%20IF%20function%3F%20Should%20I%20be%20looking%20at%20another%20function%3F%3C%2FP%3E%3CP%3EThis%20is%20the%20%3CEM%3Eequation%3C%2FEM%3E%20%22('Tab%201'!K3-'Tab%201'!J3)*24%22%2C%20if%20that%20helps.%3C%2FP%3E%3CP%3EThank%20you%20for%20any%20assistance!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1928995%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1929432%22%20slang%3D%22en-US%22%3ERe%3A%20IF%2C%20THEN%20and%20Equations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1929432%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F880578%22%20target%3D%22_blank%22%3E%40LizzMansfield%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20should%20do%20it%2C%20though%20perhaps%20not%20the%20most%20elegant%20way.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3D--(('Tab%201'!K3-'Tab%201'!J3)*24%26gt%3B8)*-0.5%2B('Tab%201'!K3-'Tab%201'!J3)*24%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3BThe%20first%20part%20%3CSTRONG%3E--(..........)%3C%2FSTRONG%3E%20will%20evaluate%20to%201%20if%20the%20calculation%20%3CSTRONG%3E(K%20-%20J)%20x%2024%3C%2FSTRONG%3E%20results%20in%20a%20number%20%3CSTRONG%3E%26gt%3B%208%3C%2FSTRONG%3E%2C%20or%20zero%20if%20not.%20Multiply%20by%20%3CSTRONG%3E-0.5%3C%2FSTRONG%3E%20(thus%2C%20either%20-0.5%20or%20zero).%20Add%20the%20result%20of%20the%20calculation%20%3CSTRONG%3E(K%20-%20J)%20x%2024%3C%2FSTRONG%3E.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello,

I am looking for something for this situation:

IF the result of the equation is > 8, THEN the result is the equation minus 0.5, or ELSE it will just equal the original equation. Is this possible? Is it possible with the IF function? Should I be looking at another function?

This is the equation "('Tab 1'!K3-'Tab 1'!J3)*24", if that helps.

Thank you for any assistance!

3 Replies

@LizzMansfield 

This should do it, though perhaps not the most elegant way.

=--(('Tab 1'!K3-'Tab 1'!J3)*24>8)*-0.5+('Tab 1'!K3-'Tab 1'!J3)*24

 The first part --(..........) will evaluate to 1 if the calculation (K - J) x 24 results in a number > 8, or zero if not. Multiply by -0.5 (thus, either -0.5 or zero). Add the result of the calculation (K - J) x 24.

@Riny_van_Eekelen 

This worked like a charm. I appreciate the help!

@LizzMansfield Great! Glad you liked it.