如何从Excel中的两列总和中获得最大值?

给出两列,A和B是这样的:

| A | B ------------- 1 | 6 | 2 2 | 4 | 5 3 | 8 | 2 

我可以写一个excel公式,达到=MAX(A1+B1,A2+B2,A3+B3)而不必在公式中input每行。

你可以用这样的“数组公式”来做到这一点

=MAX(A1:A3+B1:B3)

CTRL + SHIFT + ENTER确认

您可以添加一个INDEX函数,使其成为一个“常规”的公式,即

=MAX(INDEX(A1:A3+B1:B3,0))

或者Excel 2010或更高版本的非数组版本

=AGGREGATE(14,6,A1:A3+B1:B3,1)

14表示AGGREGATE函数中的LARGE ,最后1表示最大

使用数组公式:

= MAX((A1:A100)+(B1:B100))

这必须使用CTRLSHIFTENTERinput,而不仅仅是input

在Visual Basic中,写这个:

 Sub Max_Sum() Dim col_1, col_2 As Double Dim Result, Result_Max As Double Dim nRow As Integer nRow = 1 'If the started row is the first Do col_1 = Cells(nRow, 1).Value col_2 = Cells(nRow, 2).Value Result = col_1 + col_2 If Result > Result_Max Then Result_Max = Result End If nRow = nRow + 1 Loop Until col_1 = "" Or col_2 = "" 'Writte the result in the C3 range Cells(3, 3).Value = Result_Max End Sub