Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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
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.