vba - IF construct in Excel -


can me perform following...

example:

         b c d  row 1 odzn 2 3   row 2 eaxo 3 4 

i need if statement gives logic...

  1. if a:1 odzn, d1=(b:1)*(c:1)*5 , else if
  2. if a:2 eaxo, d1=(b:2)*(c:2)*20 ... , on different variables.... every different variable has different multiplier.......

and i'll copy , drag formula down large set of data , macro

could help.. , possibly advise me need define variable...

the multiplier set me manually. variables defined in excel.

thanks!!

i suppose mean:

for row, if value in column odzn / eaxo, value in column d gets multiplier 5 / 20.

answer:

 =b1*c1*if(a1="odzn",5,if(a1="eaxo",20,0)) 

and drag.

you can nest many if want. (here use unnecessary 0 show how if can nested, can simplified if(a1="odzn",5,20)).

of course, can write function, like

 =b1*c1*func(a1) 

however, macros need authentication run in later versions of excel. recommend formula solution if value variation not many.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -