Use of ABS in Excel 2010 conditional formatting

Wolfy1s13

New Member
Joined
Jun 22, 2018
Messages
5
I have columns that contain both positive and negative values and wish to colour code the absolute values e.g

0-9 Green
10-19 Yellow
20-29 Amber
>30 Red

I have set up conditional formatting for the column range as shown below

=ABS($N45)<10 for Green
=IF($N45<>"",ABS($N45)>=10,"") for yellow

but this shows 10 as green and -10 as yellow. The cells in the column are formatted as 'Numbers' with no decimal points.

Has anyone come across this problem and resolved it ---- please advise
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
When I enter manually -10 or 10 then I get yellow for both.

Where is the value in N45 coming from?
 
Upvote 0
When I enter manually -10 or 10 then I get yellow for both.

Where is the value in N45 coming from?

$N45 in the conditional formatting is a calculated field of the form

=IF($M15<>"",($M15-$L$39)*1440,"") gives a value of 10
=IF($M16<>"",($M16-$L$39)*1440,"") gives a value of -10

where $M15/6 and $L$39 are a custom fields of the form hh:mm.

I think the problem is in the definition of the $N45 field but I cannot see why
 
Upvote 0
I don't see a problem with the 'definition' of $N45 but I can see potential for rounding errors, especially when you appear to be dealing with time.

If you increasing the no of decimal places in the formatting N45 what do you see?
 
Upvote 0
I don't see a problem with the 'definition' of $N45 but I can see potential for rounding errors, especially when you appear to be dealing with time.

If you increasing the no of decimal places in the formatting N45 what do you see?

Updated $N45 to two decimal places but it has no effect

If I use two completely new cells one with 10 and the other one with -10 and apply the same conditional formatting both are yellow. If I populate those cells using the N45 calculation , ABS(Cell) <9 and ABS(cell)>=10, the positive value is green and the negative with yellow.
 
Upvote 0
Updated $N45 to two decimal places but it has no effect

If I use two completely new cells one with 10 and the other one with -10 and apply the same conditional formatting both are yellow. If I populate those cells using the N45 calculation , ABS(Cell) <9 and ABS(cell)>=10, the positive value is green and the negative with yellow.
Sorry the calculation is e.g. =IF($M16<>"",($M16-$L$39)*1440,"") not as in previous line
 
Upvote 0
When dealing with time the rounding errors can be very small.

What happens if you add ROUND to the formulas?
 
Upvote 0
When dealing with time the rounding errors can be very small.

What happens if you add ROUND to the formulas?

Tried ROUND which worked - thanks.
However also tried a change to the conditional formatting

Changed =ABS($N45)<10 to ABS($N45) <= 9
and
=IF($N45<>"",ABS($N45)>=10,"") to
=IF($N45<>"",ABS($N45)>9,"")

and that worked as well?

Thanks for your time and advice. Really appreciated as it was driving me mad.
<strike></strike>
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top