Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Please help me!!!!!!!
How can I optimize the following statements:
if(Len(Cod_Cuenta)=12 and Right(Left(Cod_Cuenta,10),2)=01,Left(Cod_Cuenta,10),
if(Len(Cod_Cuenta)=12 and Right(Left(Cod_Cuenta,10),1)=02,Left(Cod_Cuenta,10),
if(Len(Cod_Cuenta)=12 and Right(Left(Cod_Cuenta,10),1)=03,Left(Cod_Cuenta,10),
if(Len(Cod_Cuenta)=12 and Right(Left(Cod_Cuenta,10),1)=04,Left(Cod_Cuenta,10),
if(Len(Cod_Cuenta)=12 and Right(Left(Cod_Cuenta,10),1)=05,Left(Cod_Cuenta,10),
if(Len(Cod_Cuenta)=12 and Right(Left(Cod_Cuenta,10),1)=06,Left(Cod_Cuenta,10),
if(Len(Cod_Cuenta)=12 and Right(Left(Cod_Cuenta,10),1)=07,Left(Cod_Cuenta,10),
if(Len(Cod_Cuenta)=12 and Right(Left(Cod_Cuenta,10),1)=08,Left(Cod_Cuenta,10),
if(Len(Cod_Cuenta)=12 and Right(Left(Cod_Cuenta,10),1)=09,Left(Cod_Cuenta,10),
if(Len(Cod_Cuenta)=12 and Right(Left(Cod_Cuenta,10),2)=10,Left(Cod_Cuenta,10),
if(Len(Cod_Cuenta)=12 and Right(Left(Cod_Cuenta,10),2)=11,Left(Cod_Cuenta,10)
)
)
)
)
)
)
)
)
)
)
)
your exp can be written as below in short but it would not give you much of a performance boost .
if(Len(Cod_Cuenta)=12,
If(
Match(Right(Left(Cod_Cuenta,10),2),'01','10','11')
or
Match(Right(Left(Cod_Cuenta,10),1),'2','3','4','5','6','7','8','9'),Left(Cod_Cuenta,10)
)
)
your exp can be written as below in short but it would not give you much of a performance boost .
if(Len(Cod_Cuenta)=12,
If(
Match(Right(Left(Cod_Cuenta,10),2),'01','10','11')
or
Match(Right(Left(Cod_Cuenta,10),1),'2','3','4','5','6','7','8','9'),Left(Cod_Cuenta,10)
)
)
But I can not put this: '01','10','11' or ,'2','3','4','5','6','7','8','9'
I want to put Left(Cod_Cuenta,10)
May be this
if(Len(Cod_Cuenta)=12,
If(Match(Mid(Cod_Cuenta, 9, 2), '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11'), Left(Cod_Cuenta,10)))
may be this
if(Len(Cod_Cuenta)=12,
If(
Not IsNull(Num(Mid(Cod_Cuenta, 9, 1))), Left(Cod_Cuenta,10)
))
I'll try! How about:
If len(Cod_Cuenta)=12 and num(Right(Left(Cod_Cuenta,10),2))<12 and num(Right(Left(Cod_Cuenta,10),2))>0,
left(Cod_Cuenta,10))