Function VBA - 3 variables

E

Elton Law

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(M10>L10, L10>K10) = Show "All DOWN"
If And(K10>L10, L10>M10) = Show "All UP"
If And(K10>L10, L10<M10) = Show "K cross L UP"
If And(K10<L10, L10>M10) = Show "K cross L down"

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

=IF(AND(K10>L10,L10>M10),"All up",IF(AND(K10>L10,M10>L10),"K cross L
Up",IF(AND(M10>L10,L10>K10),"All down",IF(AND(L10>K10,L10>M10),"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
 
H

helene and gabor

Hello Elton,

=CHOOSE(BIN2DEC( --(M10>L10)& --(L10>K10))+1,"ALL UP","K cross L down","K
cross L up","ALL DOWN")

Best Regards,

Gabor Sebo
 

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

Top