Can anyone help me perform the following…

example:

```
A B C D
row 1 ODZN 2 3
row 2 EAXO 3 4
```

I need a IF then statement which gives this logic…

- If
`A:1`

is`ODZN,`

then`D1=(B:1)*(C:1)*5`

, else if - If
`A:2`

is`EAXO`

, then`D1=(B:2)*(C:2)*20`

… and so on with different variables….

every different variable has a different multiplier…….

and I’ll copy and drag the formula down a large set of data and eventually into a macro

could anyone help.. and possibly advise me what I need to define as a variable…

The multiplier is set by me manually. The variables will be defined in excel.

Thanks!!

I suppose you mean:

for a row, if value in column A is ODZN / EAXO, then value in column D gets a multiplier 5 / 20.

Answer:

=B1*C1*IF(A1="ODZN",5,IF(A1="EAXO",20,0))

and then drag.

You can nest as many `IF`

as you want. (Here I use I an unnecessary `0`

to show how `IF`

can be nested, it can be simplified as `IF(A1="ODZN",5,20)`

).

Of course, you can write a function, then it will be like

=B1*C1*func(A1)

However, macros need authentication to run in later versions of Excel. I would recommend the formula solution if the value variation is not that many.

Tags: excelexcel, struct, vba