Hi
Is there a way to set in conditional formatting that if the cell has a decimal figure like say 5.5 to display a certain colour.
I do not want to use validity as that is already set for this cell to be a decimal or whole number.
I have set this cell to display figures in red if it is greater than the cell next to it but I want to sort of cancel that out if it is a decimal.
Cheers Jim
[Solved] Condition if decimal .5
[Solved] Condition if decimal .5
Last edited by jimbokea on Sat May 11, 2019 6:53 am, edited 1 time in total.
OPenOffice 4.1.1 on Windows 7
Re: condition if decimal .5
I admit I haven't used Conditional Formatting much, but a quick look suggest you could do this using the MOD function in the Conditional Formatting parameter
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
Re: condition if decimal .5
Hi - Can't see the relevance of MOD in this instance
OPenOffice 4.1.1 on Windows 7
Re: condition if decimal .5
MOD returns the remainder of a division operation; so for example dividing 5.5 by 1 would give a remainder of .5, but dividing an integer (whole number) by one would result in a remainder of zero.
See the HELP - F1 - for MOD for syntax.
See the HELP - F1 - for MOD for syntax.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
Re: condition if decimal .5
I think I have solved this
All this was to avoid 2 sets of numbers being reversed when entered - had happened several times in the past
The second one was always equal or higher than the first and never a decimal
The first could be a decimal or a whole number
I used the MID function to see if the middle character is a "." in the first figure as in -
IF(MID(D4;2;1)=".")
This was set is a the first condition and the figures stayed normal colour if met
2nd condition - IF(E4="";"";IF(D4>E4)) turned the first figure red if higher than the second but not if the first figure was a decimal
seems to work
All this was to avoid 2 sets of numbers being reversed when entered - had happened several times in the past
The second one was always equal or higher than the first and never a decimal
The first could be a decimal or a whole number
I used the MID function to see if the middle character is a "." in the first figure as in -
IF(MID(D4;2;1)=".")
This was set is a the first condition and the figures stayed normal colour if met
2nd condition - IF(E4="";"";IF(D4>E4)) turned the first figure red if higher than the second but not if the first figure was a decimal
seems to work
OPenOffice 4.1.1 on Windows 7
Re: [Solved] condition if decimal .5
Your formula would fail with any number that is greater than 10 in D4, since 10.5 (for example) has the . in the 3rd location.
Also please note that the MID function is meant to work with text, not numbers. The fact that is does work, I think, is a fluke.
Since you seem to have a solution that works with a string function, you might try using the SEARCH or FIND function to search for the . in D4, rather than the MID function, as then the . would be detected no matter where in the number it is located.
Please note that, again, this uses a string function on a number, not something I would recommend.
Seeing the formula you did come up with, you could also try in place of your first formula.
Also please note that the MID function is meant to work with text, not numbers. The fact that is does work, I think, is a fluke.
Since you seem to have a solution that works with a string function, you might try using the SEARCH or FIND function to search for the . in D4, rather than the MID function, as then the . would be detected no matter where in the number it is located.
Please note that, again, this uses a string function on a number, not something I would recommend.
Seeing the formula you did come up with, you could also try
Code: Select all
IF(MOD(D4;1)=0)
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
Re: [Solved] condition if decimal .5
Yes it would fail if over 10 but 10.5 would be rare as most ends max are 9. But it works with Right as well as in =IF(RIGHT(d4;2)=".5"; "ok";"") produces ok if d4 is 10.5.
You never know what happens until you try. It did not work till I put the " " around the .5 ( or .) so I guess it is accepting the .5 as text.
The fact that a decimal .5 is in that column means they have entered the figures the right way round as the next column should never have a .5 in it. I catered for this next column with validity check of not equal to a whole number. cheers Jim
You never know what happens until you try. It did not work till I put the " " around the .5 ( or .) so I guess it is accepting the .5 as text.
The fact that a decimal .5 is in that column means they have entered the figures the right way round as the next column should never have a .5 in it. I catered for this next column with validity check of not equal to a whole number. cheers Jim
OPenOffice 4.1.1 on Windows 7