Get the maximum values of column B per each distinct value of column A

前端 未结 4 1842
野趣味
野趣味 2020-12-17 04:53

I have an Excel spreadsheet of the form:

A,B
X,1
X,5
Y,4
Y,11
X,7
Z,1

I would like to get the maximum value of column B for each distinct v

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-17 05:48

    With data in columns A and B use the Array Formula:

    =MAX(IF(A1:A6="x",B1:B6))
    

    Same for "y" and "z"

    Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key.

    enter image description here

    Notice the braces in the Formula Bar

    EDIT#1:

    To generate the formulas automatically, first copy column A to column C.

    Then use the Remove Duplicate feature in the Data tab:

    enter image description here

    Then enter the Array Formula in cell D1:

    =MAX(IF(A$1:A$14=C1,B$1:B$14))
    

    and copy down:

    enter image description here

    The formula is only entered once and then copied down!

提交回复
热议问题