How to Get Maximum Value from Specific Columns in Google Sheets

google sheetsmicrosoft excel

My sheet looks something like this:
https://docs.google.com/spreadsheets/d/1IbHLts4V4hyc2bo_TfgZzZhFiMXkD5FSlPlpSm7xloY/edit?usp=sharing

enter image description here

How would I make a formula for the max/min columns, to get the maximum/minimum value for each row, but only including columns that have the value "bar"? (highlighted in green for clarity)

Best Answer

You need following formulas: MAXIFS and MINIFS.

=MAXIFS(A2:G2,$A1:$G1,"bar")
=MINIFS(A2:G2,$A1:$G1,"bar")