pls, help me to write a macro

I got 4 columns, 3 of which should be indicators for the 4th column (I want the values in the 4th column to appear automatically depending on the values of the cells in the previous 3 columns). Here are the values which should appear depending on the cell values in the previuos 3 columns:

* ZAO
* * ZAO+SC
* * * ZAO+SC
*

* ZAO+
* SC
* * SC+
* other

What macro should I write in this case

maybe smth like:

if A="*" and B=0 and C=0 then D="ZAO"

if A="*" and B="*" and C=0 then D="ZAO+SC", etc..

Thanks in advance



Answer this question

pls, help me to write a macro

  • jfy_zhang

    If statements in Excel work like this.

    If (condition, value if condition true, value if condition false)

    Like this

    If(a=b, "A does equal B", "A does not equal B")

    The values produced from the If statement go into the cell that contains the if statement

    To check a cells value you use a cell reference like A1 (first column, first row)

    If(A1=A2, "Cell A1's value does equal cells A2 value", "Cell A1's value does equal cells A2 value")

    If you want to AND if statements conditions you need to do this

    AND(A1=A2, A2=A3, A3=A4, ...)

    Put it all togther based on if - A="*" and B=0 and C=0 then D="ZAO"

    IF (AND(A1="*", B1=0, C1=0), "ZAO", "Not ZAO")

    Place this IF statement in D1.



  • pls, help me to write a macro