MaxIf with associated row info?

放肆的年华 提交于 2019-12-24 12:51:26

问题


Im using array formulas to determine the maximum value of a specific subset of row data:

=MAX(($A2:$A100="somestring")*($C2:$C100))

This works fine & gets me the maximum value in C where A = "somestring".

Now, I want to return other column values associated with this "max" row that are strings. Intuitively I think I may need to ditch the boolean logic multiplication strategy since string values are getting involved. What's the best/cleanest way to go about this?


回答1:


Try this:

=INDEX(B1:B100,MATCH(MAX((A1:A100="somestring")*(C1:C100)),(A1:A100="somestring")*(C1:C100),0))

Column you want values for is set to B in this example.




回答2:


Assuming you're interested in the string in column D, this will work:

=INDEX(($D$1:$D$100),MAX(($A2:$A100="somestring")*(ROW($C2:$C100))))

Note that since it's Indexing on the Row() you're Index column needs to start at 1, e.g., D1:D100.



来源:https://stackoverflow.com/questions/5965158/maxif-with-associated-row-info

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!