ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Function VBA - 3 variables (https://www.excelbanter.com/excel-programming/441481-function-vba-3-variables.html)

Elton Law[_2_]

Function VBA - 3 variables
 
Dear expert,
I am not good at function VBA, but I know that can help me to save a lot of
memory.

Say a cell in K10, L10 and M10
Contain figures 7,8,10

How can I write a function say in J10 type =cross(K10,L10,M10)
Outcome can be 4.
If And(M10L10, L10K10) = Show "All DOWN"
If And(K10L10, L10M10) = Show "All UP"
If And(K10L10, L10<M10) = Show "K cross L UP"
If And(K10<L10, L10M10) = Show "K cross L down"

Now I have a lengthy function in J10 which is going to copy from J10 to J32000

=IF(AND(K10L10,L10M10),"All up",IF(AND(K10L10,M10L10),"K cross L
Up",IF(AND(M10L10,L10K10),"All down",IF(AND(L10K10,L10M10),"K cross
down",""))))

I am sure using function VBA rather than full if function command can save a
lot of memory.
Hope dear expert can help.

Regards,
Elton

helene and gabor

Function VBA - 3 variables
 
Hello Elton,

=CHOOSE(BIN2DEC( --(M10L10)& --(L10K10))+1,"ALL UP","K cross L down","K
cross L up","ALL DOWN")

Best Regards,

Gabor Sebo





"Elton Law" wrote in message
...
Dear expert,
I am not good at function VBA, but I know that can help me to save a lot
of
memory.

Say a cell in K10, L10 and M10
Contain figures 7,8,10

How can I write a function say in J10 type =cross(K10,L10,M10)
Outcome can be 4.
If And(M10L10, L10K10) = Show "All DOWN"
If And(K10L10, L10M10) = Show "All UP"
If And(K10L10, L10<M10) = Show "K cross L UP"
If And(K10<L10, L10M10) = Show "K cross L down"

Now I have a lengthy function in J10 which is going to copy from J10 to
J32000

=IF(AND(K10L10,L10M10),"All up",IF(AND(K10L10,M10L10),"K cross L
Up",IF(AND(M10L10,L10K10),"All down",IF(AND(L10K10,L10M10),"K cross
down",""))))

I am sure using function VBA rather than full if function command can save
a
lot of memory.
Hope dear expert can help.

Regards,
Elton



Elton Law[_2_]

Function VBA - 3 variables
 
Hi Helen,
It doesn't work. But still thanks for reply.
Elton

"helene and gabor" wrote:

Hello Elton,

=CHOOSE(BIN2DEC( --(M10L10)& --(L10K10))+1,"ALL UP","K cross L down","K
cross L up","ALL DOWN")

Best Regards,

Gabor Sebo





"Elton Law" wrote in message
...
Dear expert,
I am not good at function VBA, but I know that can help me to save a lot
of
memory.

Say a cell in K10, L10 and M10
Contain figures 7,8,10

How can I write a function say in J10 type =cross(K10,L10,M10)
Outcome can be 4.
If And(M10L10, L10K10) = Show "All DOWN"
If And(K10L10, L10M10) = Show "All UP"
If And(K10L10, L10<M10) = Show "K cross L UP"
If And(K10<L10, L10M10) = Show "K cross L down"

Now I have a lengthy function in J10 which is going to copy from J10 to
J32000

=IF(AND(K10L10,L10M10),"All up",IF(AND(K10L10,M10L10),"K cross L
Up",IF(AND(M10L10,L10K10),"All down",IF(AND(L10K10,L10M10),"K cross
down",""))))

I am sure using function VBA rather than full if function command can save
a
lot of memory.
Hope dear expert can help.

Regards,
Elton




All times are GMT +1. The time now is 09:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com