highlight cells more or less than 0.2 to nearest 1

CJS548

New Member
Joined
Dec 11, 2013
Messages
25
Hi,
is there any way to highlight the cells in a range, if:
the value is more or less than 0.2 to the nearest 1
there are already a formula in each of those cells in the range, which will change according to what i change at the other cell.

example:
if cell value = 6.09, highlight
if cell value = 6.19, highlight
if cell value = 6.89, highlight
if cell value = 6.79, no highlight
if cell value = 2.20, highlight
if cell value = 3.21, no highlight
if cell value = 10.96, highlight
meaning if it is 0.2 more or less than the nearest one, it will get highlighted, if not, then no highlight.
the range is $Y$7:$AC$10

vba can be applied.
thanks!
 

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,314
What do you mean by "nearest one"?

I'm looking at cell B2.
The nearest one to it is B1.
And A2.
And C2.
And B3.
And diagonally A1, C1, A3 and C3.

So which cell are we talking about?
 
Last edited:

Eric Golf

Active Member
Joined
Dec 19, 2007
Messages
323
Hi CJS548,

If you mean within 0.2 of a whole number, then try conditional formatting with the below:-

Code:
=OR(MOD(Y7,1)>=0.8,MOD(Y7,1)<=0.2)
Hope this helps,

Eric
 
Last edited:

CJS548

New Member
Joined
Dec 11, 2013
Messages
25
Sorry I didn't make it clear...
So, a number after rounding up or rounding down to no decimal, is my so called "nearest 1"
So, if the cells gives a value that is variance by 0.2 to its nearest zero decimal, then highlight.
for example,
if cells = 19.13, highlight, coz its within 0.2 from 19
if cells = 15.92, highlight, coz its within 0.2 from 16
if cells = 7.36, don't highlight, coz its more than 0.2 from 7
Hope it is clear now...
the range for this to apply is $Y$7:$AC$10
Thanks
 

CJS548

New Member
Joined
Dec 11, 2013
Messages
25
Any idea................. o_O
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
41,800
Office Version
365
Platform
Windows
Try this Conditional Formatting

xl2bb.xlam
B
1
26.09
36.19
46.89
56.79
62.2
73.21
8
910.96
109.8
CF Near
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:B10Expression=AND(B2<>"",ABS(B2-ROUND(B2,0))<=0.2)textNO
 

Forum statistics

Threads
1,078,435
Messages
5,340,255
Members
399,361
Latest member
Linford

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top