Conditional Format when calculation equals whole number

NWPhotoExplorer

New Member
Joined
Jan 19, 2021
Messages
21
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
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!

Thanks in advance!
 

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
Joined
Oct 4, 2014
Messages
102
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!

Thanks in advance!
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
Joined
Jan 19, 2021
Messages
21
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
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
Joined
Oct 4, 2014
Messages
102
Change the conditional formatting formula to
Excel Formula:
=MINUTE(A1)=0
 

StephenCrump

MrExcel MVP
Joined
Sep 18, 2013
Messages
4,245
Office Version
  1. 365
Platform
  1. Windows
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?
 
Solution

Forum statistics

Threads
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.
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
Top