简体   繁体   中英

find the max value based on criteria in different column

I need a little help in excel:

in the attached image, if I want to choose the max value of the cells in column M for every time the sum of the values in column G would be 12, is it possible?

For example: the sum of G2+G3+G4+G5 = 12 so I need formula that will choose the max value between M2,M3,M4,M5 (13) and then go to the next sum of cells in column G that would be 12 .

在此处输入图像描述

  1. Place this formula in cell F2 (assuming your data starts in row 2) =IF(MOD(SUM(G$2:G2),12)=0, MAX(INDIRECT("M"&MAX(IF(F1:F$2<>"",ROW(F1:F$2),1))+1):M2), "")
  2. Then drag down as far as you need

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM