• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Macro - Formula help

k3vsmith

Member
I have this formula that is copied to all rows in column G (cnEVMethod). Its working. But now I want to add to it.

If there is a P in column C (cnWBSEl)and 0 in column G (cnEVMethod), if those two conditions are also met I want n/a placed in that rows cell.


Code:
=IF(" & cnWBSEl & "=""W""," & _
Range(cnEVMethod).Offset(1, 0).Address(rowabsolute:=False, columnabsolute:=False) & _
",IF(ISBLANK(" & cnEVMethod & "),""""," & cnEVMethod & "))

Where
cnWBSEl = "c1"
cnEVMethod = "g1"

Is this possible? I want the existing formula to do as it is. Just want to add in the case where EVMethod is showing 0 and WBSEl is showing P. Instead of that number being 0 I want it to read n/a

Thanks in advance.
 
The format for If in VBA allows for you to use "And" & "Or" functions

if (x>7 and x<10) or Y=0 then

etc
 
Ok, thats good to know. I will experiment with adding to the formula with "And"/"or". That will probably do the trick. Thanks
 
I think I may go another route because the formula is pasted with values. So I basically just want to run another formula against same column.
Basically =IF(G198=0, "n/a").
But can you help adjust where if not =0 it keeps the value as is? Currently it changes value to false if I copy it down and value is not 0.

Thanks
 
Nevermind, didnt realize just adding the cell at the end would return same value.
=IF(G198=9, "n/a",G198)
 
Back
Top