# Conditional Format when calculation equals whole number

#### NWPhotoExplorer

##### New Member
I have a calculation that is adding up the values of some fields. I am trying to get it to highlight when the number it adds up to is a whole number, like 1, 2, 3, etc.
My calculation is =SUBTOTAL(9,T_JOBS[Hours (decimal)])

I tried using INT and MOD and some IF statements, but I am not coming up with anything that works. This has to be so simple, yet I've been struggling with it all day. Hopefully, someone out there knows how to do this!

### Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

#### mabbutt

##### Board Regular
I have a calculation that is adding up the values of some fields. I am trying to get it to highlight when the number it adds up to is a whole number, like 1, 2, 3, etc.
My calculation is =SUBTOTAL(9,T_JOBS[Hours (decimal)])

I tried using INT and MOD and some IF statements, but I am not coming up with anything that works. This has to be so simple, yet I've been struggling with it all day. Hopefully, someone out there knows how to do this!

Select the cell(s) that you want to be highlighted and add this formula via conditional formatting:

Excel Formula:
``=IF(LEN(A1),MOD(A1,1)=0,"")``

Change A1 to the cell you are referencing.

#### NWPhotoExplorer

##### New Member
I had run across that formula yesterday, but I can't seem to make it work. I'm not sure what the deal is. Here is a small sample of my table. I am working with time, so I wonder if that is the issue.

Job Tracker.xlsx
ABC
1Total Hours
21.00
3Start Time (hh:mm)End Time (hh:mm)Hours (decimal)
46:457:240.650
57:257:460.350
6
7FALSE
Sheet1
Cell Formulas
RangeFormula
C2C2=SUBTOTAL(9,Table1[Hours (decimal)])
C4:C5C4=([@[End Time (hh:mm)]]-[@[Start Time (hh:mm)]])*24
C7C7=IF(LEN(C2),MOD(C2,1)=0,"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C2Expression=IF(LEN(C2),MOD(C2,1)=0,"")textNO

#### mabbutt

##### Board Regular
Change the conditional formatting formula to
Excel Formula:
``=MINUTE(A1)=0``

#### StephenCrump

##### MrExcel MVP
Because of minor rounding discrepancies, C2 is actually 0.999999999999984, not 1.

I suggest you change C2: =ROUND(SUBTOTAL(9,Table1[Hours (decimal)]),N)

where N is your choice, say 2?

Replies
6
Views
243
Replies
2
Views
103
Replies
5
Views
105
Replies
4
Views
106
Replies
1
Views
76

1,141,124
Messages
5,704,436
Members
421,349
Latest member
Santhosh3188

### 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.

### Which adblocker are you using?

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

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