Merge the two formulas together?

First formula:
=INDEX(A6:A99,MATCH(LARGE(IF(B6:B99="m",AG6:AG99,""),1),AG6:AG99,0))

Second formula:
=MAX(IF(AG6:AG99<180,AG6:AG99,""))

As long as the value is less than 180

Thanks in advance.

Doug