vendredi 21 juin 2019

Excel concatenate strings including if else statements

I have this table

      A      B       C       D
 1   User | priv1 | priv2 | priv3
 2   test |   y   |   n   |   n   
 3   more |   n   |   y   |   n  

and so on and I want to generate db2 commands from that.

 ="GRANT "&(IF B2="y", B1, "")& ", "&(IF C2="y", C1, "" )& ", "&(IF D2="y", D1, "" )&" on DATABSE TO USER "&A2&";"

should there for be

 GRANT priv1 ON DATABASE TO USER test;

However I can't get those IF parts to work.

Any idea? I tried many syntaxes but none get it to work. Google wasn't my friend either.

EXCEL 365 on Windows 10

Thanks

Aucun commentaire:

Enregistrer un commentaire