# Query with If Statement

• Ok quick question what I want to do is if there is a value within E4 then multiply E3*H4 and if E4 is empty then do nothing.

This is the formula I came up with but I am getting an error i.e. the formula you typed contains an error

Anyone know how I could edit this to make it work correctly

Code
``=If (IsEmpty(E4)),"",(=E3*H4))``
• Re: Query with If Statement

Hi alic

Try this:

Code
``````a = Range("E3")
b = Range("H4")
If Range("E4") > "" Then
Range("I4") = a * b
End If

End Sub``````

Alring

• Re: Query with If Statement

Sorry I should have stated I plan to put this statement into cells throughout a workbook so I was hoping to write this into each cell that requires this formula

• Re: Query with If Statement

As in each cell will have a different values but a similar formula

• Re: Query with If Statement

If it's text you write in cell E4 then try

=IF(ISTEXT(E4);E3*H4;" ")

if it's numbers you write in cell E4 then try

=IF(ISNUMBER(E4);E3*H4;" ")

You can also use

=IF(OR(ISTEXT(E4);ISNUMBER(E4));E3*H4;" ")

• Re: Query with If Statement

cheers thanks very much for your help

## Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!