Which of these 2 functions should I choose? (1 Viewer)

MyTech

Access VBA
Local time
Today, 14:35
Joined
Jun 10, 2010
Messages
108
A quick question.

Which of these 2 functions should I use - which one will use less CPU etc?


I want to return "1" for every 3,6,8,11,14,17 or 19th of every 19 numbers, and a "0" for the others.

  1. IF(MOD(MOD(MOD(MOD(MOD(MOD(MOD(<Number>,19),17),14),11),8),6),3)=0,1,0)
  2. CHOOSE(MOD(<Number>-1,19)+1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,1)

I believe #2 will do much less work, tell me if I am wrong.
 

vbaInet

AWF VIP
Local time
Today, 19:35
Joined
Jan 22, 2010
Messages
26,374
Because this is the Access section of the forum I will say NONE. :)

Are you doing this in Excel?
 

MyTech

Access VBA
Local time
Today, 14:35
Joined
Jun 10, 2010
Messages
108
I'm planning to do it in access, I just do now the testings in Excel.
 

vbaInet

AWF VIP
Local time
Today, 19:35
Joined
Jan 22, 2010
Messages
26,374
Not the ideal way of going about things. Access and Excel are two different applications and there are lots of differences in the way to reach a solution.

The Access way would be to use a SELECT case statement in a function.
 

MyTech

Access VBA
Local time
Today, 14:35
Joined
Jun 10, 2010
Messages
108
Right, thank you.

I didn't think enough (of the 'interpreting to Access' part) before asking.
 

Users who are viewing this thread

Top Bottom