Conditional formatting not working with UDF cell

tp2468

New Member
Joined
Mar 5, 2009
Messages
45
Hi All,

I am having problems with conditional formatting. I have written a UDF which returns an integer number {-3, -2,-1, 0, 1, 2, 3} and use conditional formatting to colour appropriately. For some reason, this is not working correctly. Sometimes zero will colour red and sometimes it will colour orange (as it should). The value in the cell is exactly zero in both cases and I cannot find any logical reason as to why this isn't working.

Any help is hugely appreciated. If needed I can post my UDF.

Thanks

Tom
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Thanks for the reply. I figured it out in the end. Apparently excel can return -0 in some UDF's. So 0 was giving one colour whilst -0 was giving a different colour. It was fixed by adding +0 at the end to convert the -0 to 0.
 
Upvote 0
Glad you got that sorted Tom, and thanks for letting us know the actual situation and solution, will undoubtedly help others in the future.
 
Upvote 0

Forum statistics

Threads
1,215,606
Messages
6,125,800
Members
449,261
Latest member
Rachel812321

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