ISINTEGER function

J

Jim Berglund

Is there one?

There should be...

Is there a work around for it?

Thanks,
Jim Berglund
 
K

KimCo

What are you trying to accomplish? ISINTEGER doesn't exist that I am aware
of, but there is INT, ROUND, TRUNC...there are a bunch out there depending
upon what you are trying to do.

KimCo
 
B

Beege

Jim said:
Is there one?

There should be...

Is there a work around for it?

Thanks,
Jim Berglund


Jim,

=MOD(cell,1) for an integer is 0, is decimal > 0 for all others

Beege
 
J

Jim Berglund

I want to select rows based in whether a value is an integer or not.
Beege sent me
=MOD(cell,1) for an integer is 0, is decimal > 0 for all others
Which does it. Thanks,
Jim Berglund
 
V

vik wig

Here is a function I wrote for myself which I use everywhere...

Function IsInteger(Target As Range) As Boolean

If Not IsNumeric(Range(Target).Value) Then
IsInteger = False
Else
If Range(Target).Value - Int(Range(Target).Value) = 0 Then
IsInteger = True
Else
IsInteger = False
End If
End If

End Function




Jim Berglund wrote:

ISINTEGER function
10-May-07

Is there one

There should be..

Is there a work around for it

Thanks
Jim Berglund

Previous Posts In This Thread:

ISINTEGER function
Is there one

There should be..

Is there a work around for it

Thanks
Jim Berglund

What are you trying to accomplish?
What are you trying to accomplish? ISINTEGER does not exist that I am awar
of, but there is INT, ROUND, TRUNC...there are a bunch out there dependin
upon what you are trying to do

KimCo

Re: ISINTEGER function
Jim Berglund wrote

Jim

=MOD(cell,1) for an integer is 0, is decimal > 0 for all other

Beege

Thanks a lot - That's what I needed!
Thanks a lot - That's what I needed

Jim Berglund

I want to select rows based in whether a value is an integer or not.
I want to select rows based in whether a value is an integer or not
Beege sent m
=MOD(cell,1) for an integer is 0, is decimal > 0 for all other
Which does it. Thanks
Jim Berglun
"KimCo" <KCostalesATourcoopDOTcomNOSPAM> wrote in message


Submitted via EggHeadCafe - Software Developer Portal of Choice
XAML Organizer
http://www.eggheadcafe.com/tutorials/aspnet/ac373a5d-e497-4e07-9186-12166e83a024/xaml-organizer.aspx
 
B

Bob Phillips

Surely, that function should be

Function IsInteger(Target As Range) As Boolean

If Not IsNumeric(Target.Value) Then
IsInteger = False
Else
If Target.Value - Int(Target.Value) = 0 Then
IsInteger = True
Else
IsInteger = False
End If
End If

End Function


but why not just use

=EXACT(F1,INT(F1))
 
S

Steve Dunn

or even just =int(a1)=a1


Bob Phillips said:
Surely, that function should be

Function IsInteger(Target As Range) As Boolean

If Not IsNumeric(Target.Value) Then
IsInteger = False
Else
If Target.Value - Int(Target.Value) = 0 Then
IsInteger = True
Else
IsInteger = False
End If
End If

End Function


but why not just use

=EXACT(F1,INT(F1))

--

HTH

Bob
 
T

Tushar Mehta

For a Excel2007+ formula, use =IFERROR(B4=INT(B4),FALSE) to test B4
for an integer.

If you must use a function, and for all the issues with VBA functions,
it does have the benefit of being self-documented and a single point
of maintenance, use - given the assumptions embedded in the solution -
Option Explicit

Function IsInteger(X As Range) As Boolean
If X.Cells.Count > 1 Then
ElseIf IsNumeric(X.Value) Then
IsInteger = X.Value = Fix(X.Value)
End If
End Function


Here is a function I wrote for myself which I use everywhere...

Function IsInteger(Target As Range) As Boolean

If Not IsNumeric(Range(Target).Value) Then
IsInteger = False
Else
If Range(Target).Value - Int(Range(Target).Value) = 0 Then
IsInteger = True
Else
IsInteger = False
End If
End If

End Function




Jim Berglund wrote:

ISINTEGER function
10-May-07

Is there one?

There should be...

Is there a work around for it?

Thanks,
Jim Berglund

Previous Posts In This Thread:

ISINTEGER function
Is there one?

There should be...

Is there a work around for it?

Thanks,
Jim Berglund

What are you trying to accomplish?
What are you trying to accomplish? ISINTEGER does not exist that I am aware
of, but there is INT, ROUND, TRUNC...there are a bunch out there depending
upon what you are trying to do.

KimCo

Re: ISINTEGER function
Jim Berglund wrote:


Jim,

=MOD(cell,1) for an integer is 0, is decimal > 0 for all others

Beege

Thanks a lot - That's what I needed!
Thanks a lot - That's what I needed!

Jim Berglund

I want to select rows based in whether a value is an integer or not.
I want to select rows based in whether a value is an integer or not.
Beege sent me
=MOD(cell,1) for an integer is 0, is decimal > 0 for all others
Which does it. Thanks,
Jim Berglund
"KimCo" <KCostalesATourcoopDOTcomNOSPAM> wrote in message


Submitted via EggHeadCafe - Software Developer Portal of Choice
XAML Organizer
http://www.eggheadcafe.com/tutorials/aspnet/ac373a5d-e497-4e07-9186-12166e83a024/xaml-organizer.aspx
Regards,

Tushar Mehta
Microsoft MVP Excel 2000-present
www.tushar-mehta.com
Excel and PowerPoint tutorials and add-ins
 
S

Steve Dunn

Hi Bernard,

The EXACT returns FALSE instead of an error when the cell contains text.

Steve D.
 
S

Steve Dunn

or even:

Public Function IsInteger(Target As Variant) As Boolean

IsInteger = False
If IsNumeric(Target) Then IsInteger = Target = Int(Target)

End Function
 
B

Bernard Liengme

This is not what I am seeing in Excel 2003 or Excel 2010; with text in A1
=EXACT(A1,INT(A1)) returns #VALUE!
best wishes
Bernard
 
S

Steve Dunn

Label me puzzled!

I could have sworn I got FALSE when I tried this the other day, now I get
#VALUE!

Bob, where are you?
 
B

Bernard Liengme

Tusha's approach is better
Bernard

Steve Dunn said:
Label me puzzled!

I could have sworn I got FALSE when I tried this the other day, now I get
#VALUE!

Bob, where are you?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top