Super User is a question and answer site for computer enthusiasts and power users. 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

I have data in two columns. I would like the sum of the two columns, using the maximum value for each row.

For instance

C1  C2
 1   2
 4   3
11      
    10
 5   7

The result would be 2+4+11+10+7.

I would prefer if the solution worked in Google Spreadsheets, but if that can't happen Excel would be ok.

share|improve this question
up vote 5 down vote accepted

For a one cell solution you can use an "array formula" like this in excel

=SUM(IF(A2:A6>B2:B6,A2:A6,B2:B6))

confirmed with CTRL+SHIFT+ENTER

In google docs you should be able to do the same - either use CTRL+SHIFT+ENTER with the above or use

=ARRAYFORMULA(SUM(IF(A2:A6>B2:B6,A2:A6,B2:B6)))

share|improve this answer
    
Works perfectly. Thanks. – Chris Marasti-Georg Jan 1 '12 at 17:39

Is this too simple?

C1  |C2   |C3
1   |2    |=MAX(A2,B2)
4   |3    |=MAX(A3,B3)
11  |     |=MAX(A4,B4)
    |10   |=MAX(A5,B5)
5   |7    |=MAX(A6,B6)
    |     |=SUM(C2:C6)
share|improve this answer
    
Looks good. If no one posts a one-cell answer I'll accept. – Chris Marasti-Georg Jan 1 '12 at 17:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .