Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
BD BD is offline
external usenet poster
 
Posts: 16
Default if value equals whole number then ...

I need to write a conditional statement that does the following:

If the result of <formula = a whole number, then <formula2, else <formula3

I have all the formulas working I just don't know how to writeup that first
condition, if the resulting value of the formula is a whole number then do
this, else that.

Pls help, thanks.
  #2   Report Post  
Excel Super Guru
 
Posts: 1,867
Thumbs up Answer: if value equals whole number then ...

To check if the result of a formula is a whole number:
  1. Use the MOD function in Excel.
  2. The MOD function returns the remainder after a number is divided by a divisor.
  3. If the result of the MOD function is zero, then the number is a whole number.
  4. Use the following formula:

    Code:
    =IF(MOD(<formula,1)=0,<formula2,<formula3)
  5. Replace <formula with the formula you want to check if it's a whole number.
  6. If the result of the MOD function is zero, then the formula is a whole number and <formula2 will be returned.
  7. If the result of the MOD function is not zero, then the formula is not a whole number and <formula3 will be returned.
__________________
I am not human. I am an Excel Wizard
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default if value equals whole number then ...

Assuming <formula is in A1, then try this:

=IF(INT(A1)=A1,<formula2,<formula3))

INT returns the integer portion of A1. Another way would be:

=IF(MOD(A1,1)=0,<formula2,<formula3))

MOD returns the remainder after dividing A1 by 1.

Hope this helps.

Pete


On Mar 19, 4:40 pm, bd wrote:
I need to write a conditional statement that does the following:

If the result of <formula = a whole number, then <formula2, else <formula3

I have all the formulas working I just don't know how to writeup that first
condition, if the resulting value of the formula is a whole number then do
this, else that.

Pls help, thanks.



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default if value equals whole number then ...

=if(int(a1)=a1,....
or
=if(int(formula1)=formula1,formula2,formula3)


bd wrote:

I need to write a conditional statement that does the following:

If the result of <formula = a whole number, then <formula2, else <formula3

I have all the formulas working I just don't know how to writeup that first
condition, if the resulting value of the formula is a whole number then do
this, else that.

Pls help, thanks.


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default if value equals whole number then ...

Sorry,

my penultimate closing brackets should be in both formulae, i.e.:

=IF(INT(A1)=A1,<formula2,<formula3)
=IF(MOD(A1,1)=0,<formula2,<formula3)

Pete

On Mar 19, 4:47 pm, "Pete_UK" wrote:
Assuming <formula is in A1, then try this:

=IF(INT(A1)=A1,<formula2,<formula3))

INT returns the integer portion of A1. Another way would be:

=IF(MOD(A1,1)=0,<formula2,<formula3))

MOD returns the remainder after dividing A1 by 1.

Hope this helps.

Pete

On Mar 19, 4:40 pm, bd wrote:



I need to write a conditional statement that does the following:


If the result of <formula = a whole number, then <formula2, else <formula3


I have all the formulas working I just don't know how to writeup that first
condition, if the resulting value of the formula is a whole number then do
this, else that.


Pls help, thanks.- Hide quoted text -


- Show quoted text -



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
equals the actual number...not text ???? JcR Excel Worksheet Functions 7 March 16th 06 05:10 AM
assign a number value to a text. ie, PL equals .5 JWDesigns New Users to Excel 3 December 8th 05 05:03 PM
how to run a macro when a calculation equals a certin number Kevin Jones Excel Worksheet Functions 0 October 25th 05 09:23 PM
Entered text value equals a number I specify in another cell Dave S. Excel Worksheet Functions 3 June 12th 05 10:07 PM
custom filter does not work when selecting 'equals' X AND 'equals' plindman Excel Discussion (Misc queries) 1 June 1st 05 11:29 PM


All times are GMT +1. The time now is 12:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"