Function VBA - 3 variables

  • Thread starter Thread starter Elton Law
  • Start date Start date
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
 
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
 
Back
Top