Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

How do you do an IF ... OR ... THEN statement in a Google spreadsheet? In PHP I would do this:

if($C7 == "U.S.A." || $C7 == "Canada"){ ...

How to do the same as a spreadsheet formula?

At the moment I have

= IF ( C7 = "U.S.A." , "The Americas" , "Europe" )

I'd like to say if C7 = "U.S.A." OR "Canada"...

NB: I should have been able to (and tried extensively to) Google this, but the search engine ignores the words IF and OR

share|improve this question
add comment

1 Answer

up vote 11 down vote accepted

In Google Spreadsheets, OR is a function (with any number of arguments), so you would write

IF (OR(C7 = "U.S.A."; C7 = "Canada"); "The Americas"; "Europe")

See the example spreadsheet I set up.

Also, check the Google Spreadsheets function list.

Note that my example code uses ; - you might have to use ,, depending on your locale settings.

share|improve this answer
    
Great, thank you for all your help! –  Djave Feb 5 '13 at 16:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.