Need some help with Excel. How do I do a True/False statement to see if a number is whole?

Swanny

Diamond Member
Mar 29, 2001
7,456
0
76
Hello all,

I'm doing a little experiment with prime numbers and where you might find twin primes. Anyway, I just started this afternoon. I'm doing everything in an Excel spreadsheet, but I'm stuck now.

All I need to do is have it tell me (True/False style) if the number in a cell is a whole number. For the life of me I can't figure out any way to do it. Can someone help me out with a command that will do this?

Alternately, if I could have it tell me directly if a number is prime that'd be great too. I'm doing it this way because I couldn't find a prime command either.


Thanks,
Swan

 

notfred

Lifer
Feb 12, 2001
38,241
4
0
I take it that excel either doesn't do modulus (I doubt that) or you have no idea what it is.
 

Swanny

Diamond Member
Mar 29, 2001
7,456
0
76
You take it correctly (the I have no idea part). Would you care to explain please?
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Modulus will return the remainder in a division operation. For example, 6 mod 4 is 2. (6 divided by 4 is 1, remainder 2).

In msot programming languages, you use the modulus operator like this:

answer = 6 % 4;

and answer will now be 2.

I've never done in in excel, but I'd imagine it's the same. If you want to see if number's divide equally, jsut check to see if the modulus is 0.