Want to write formula - =IF(H3=TRUE OR B2 < B3, TRUE)

  • Thread starter Thread starter Angus
  • Start date Start date
A

Angus

Hello

I want an if which checks two conditions

If it was in C++ would look like this:

if(H3 == "TRUE") || (B2 < B3)
//update cell contents to "TRUE"

The || is like an OR - ie can be this or that.

Hopw can I do this in Excel VBA?

Angus
 
Hello Angus,

If (Range("H3").text = "TRUE") or (Range("B2").value < Range
("B3").value) then
....

Regards,
Bernd
 
=IF(OR(H3=TRUE,B2<B3,TRUE,FALSE)
This can be simplified to
OR(H3,B2<B3)

Not I have not use quotes as in "TRUE" since you can type TRUE into a cell
an it is treated as a Boolean value not as text.

best wishes
 
Hello Bernard,

But you are right if H3 contains a boolean value already (and not the
string "TRUE"):
If Range("H3").value or (Range("B2").value < Range
("B3").value) then
....

Regards,
Bernd
 
Back
Top