Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 22 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

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.