1

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...

  1. If A:1 is ODZN, then D1=(B:1)*(C:1)*5 , else if
  2. 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!!

2
  • where 3 and 10 come from, why D1 has 2 value Commented Jul 1, 2011 at 4:02
  • @Michael Downey: Please choose a question title that is more descriptive than "Excel VBA Question". Commented Jul 4, 2011 at 7:24

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.