Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Multiple of a Variable in an If function?

I am looking to use an IF function and i want the code to do a certain
something if the variable used is a multiple of 6. (i know this is fixable
with fairly simple math, but i havent even thought about algebra for 4years)

i want the code to look something like this
If Variable1 Is (Multiple of 6) then
Code....
Code...
End If

Thanks

ironhydroxid
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Multiple of a Variable in an If function?

If variable mod 6 = 0 then
'your code
End If

If this post helps click Yes
---------------
Jacob Skaria


"ironhydroxide" wrote:

I am looking to use an IF function and i want the code to do a certain
something if the variable used is a multiple of 6. (i know this is fixable
with fairly simple math, but i havent even thought about algebra for 4years)

i want the code to look something like this
If Variable1 Is (Multiple of 6) then
Code....
Code...
End If

Thanks

ironhydroxid

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Multiple of a Variable in an If function?

You are amazing!!

"Jacob Skaria" wrote:

If variable mod 6 = 0 then
'your code
End If

If this post helps click Yes
---------------
Jacob Skaria


"ironhydroxide" wrote:

I am looking to use an IF function and i want the code to do a certain
something if the variable used is a multiple of 6. (i know this is fixable
with fairly simple math, but i havent even thought about algebra for 4years)

i want the code to look something like this
If Variable1 Is (Multiple of 6) then
Code....
Code...
End If

Thanks

ironhydroxid

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Multiple of a Variable in an If function?

Function MultOfSix(x) As Boolean

MultOfSix = x / 6 = Int(x / 6)

End Function


To use:

If MultOfSix(yourVar) then
'your code
Else
'not multiple of six
End If

--
Steve

"ironhydroxide" wrote in message
...
I am looking to use an IF function and i want the code to do a certain
something if the variable used is a multiple of 6. (i know this is
fixable
with fairly simple math, but i havent even thought about algebra for
4years)

i want the code to look something like this
If Variable1 Is (Multiple of 6) then
Code....
Code...
End If

Thanks

ironhydroxid


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
In WORKDAY function, how to exclude multiple/variable holiday rang Harold Shea Excel Discussion (Misc queries) 4 August 3rd 09 06:53 PM
Multiple Variable Formula Help Beth Ann Excel Worksheet Functions 3 January 10th 08 01:26 AM
Help for multiple & variable validation function Montu Excel Worksheet Functions 1 December 20th 07 07:26 AM
Passing multiple strings to variable in Replace Function ExcelMonkey Excel Programming 1 February 7th 06 05:05 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM


All times are GMT +1. The time now is 05:51 PM.

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

About Us

"It's about Microsoft Excel"