Selecting the max with a condition in excel

后端 未结 2 1418
眼角桃花
眼角桃花 2020-12-20 06:51

I have a range in excel with dates and values

http://lh4.ggpht.com/_i-hI_3gfy08/SoSIopeZUZI/AAAAAAAABEk/KjFnq57VTUc/table.png EDIT:image added

I want to sele

相关标签:
2条回答
  • 2020-12-20 07:21

    The equivalent of SUMIF in Excel is something like this:

    {=MAX(IF(CategoryColumn="High",ValueColumn,"")}

    Where

    • CategoryColumn is the column containing your categories (e.g., "Low", "Med", "High")
    • ValueColumn is the column containing the data you want to get the max of

    NOTE: This is an array formula so you must press Ctrl-Shift-Enter when entering this formula instead of just Enter. Also, don't actually type in the braces {}. The braces show up automatically to indicate that you've entered an array formula.

    NOTE 2: You can actually name a range of data. For example, select the range A1:A20. Right-Click and select "Name a Range..." So, for this example, you can select your category column and name it CategoryColumn. Same with ValueColumn.

    Array formulas allow you to do IF statements and other functions on a whole range of data instead of just a single value.

    This example checks if the value in the "category column" is "High". If it is, it puts the neighboring "value" into the MAX function, otherwise it puts a blank. This gives you the maximum of all the "High" values.

    P.S. I don't think the img tag works on this site...can't see your image.

    0 讨论(0)
  • 2020-12-20 07:34

    There are three options available.

    My preferred option is to create a pivot table without a helper column.

    • Option 1: Use a pivot table

    Create a pivot table of your data.

    Set the row to the date field and group it by year. Alternately a 'Year' helper column could be used by adding a column with this formula.

    =YEAR(A2)
    

    Set the data items value portion of the pivot table to be the MAX of your 'High' field

    • Option 2: Use the DMAX function

    Add a helper column titled year with the formula

    =YEAR(A2)
    

    Then add a formula for each year

    =DMAX(A1:C21,"High",F13:F14)
    
    • Option 3: Use an array formula

    Enter an array formula for each year using the Ctrl-Shift-Enter keys.

    {=MAX(IF(YEAR(A2:A21)=2008,B2:B21))}
    
    0 讨论(0)
提交回复
热议问题