# IF a whole number then...

#### wwbwb

##### Well-known Member
I'm trying to set up a formula so that if the number in a1 is a whole number then the formula will return "Yes" otherwise "No". This is what I have so far, just wondering if there is a simpler way?

=if(round(a1,0)=a1,"Yes","No")

### Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

##### MrExcel MVP
=(A1-TRUNC(A1)=0)+0

Custom format the formula cell as:

[=0]"No";[=1]"Yes"

if needed.

Otherwise:

1 --> Yes
0 --> No

#### Brian from Maui

##### MrExcel MVP
Try,

=IF(MOD(A1,1)=0,"YES","NO")

#### Anthony47

##### Well-known Member
Hi wwbwb,
your formula is ok, or you could use
Code:
``=IF(MOD(A1,1),"No","Yes")``
or
Code:
``=IF(INT(A1)=A1,"Yes","No"``

But, as you see, they have all the same (limited) complexity.
Bye,

#### wwbwb

##### Well-known Member
Thanks all. They all work for what I need.

Replies
8
Views
63
Replies
0
Views
44
Replies
29
Views
372
Replies
2
Views
59
Replies
20
Views
358

1,141,596
Messages
5,707,303
Members
421,502
Latest member
PULBAG

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