You can combine the two formulas to rank only the visible values while ignoring zeros by using the SUBTOTAL function in Excel. The SUBTOTAL function can perform calculations like SUM, AVERAGE, COUNT, etc. on visible cells only.
Here's an example formula to rank the values in column A while ignoring zeros:
=IF(A2=0,"",IFERROR(RANK.AVG(SUBTOTAL(9,OFFSET(A$1,ROW(A2:A10)-ROW(A2),)),SUBTOTAL(9,OFFSET(A$1,ROW(A2:A10)-ROW(A2),))),"-"))
In this formula, SUBTOTAL(9,OFFSET(A$1,ROW(A2:A10)-ROW(A2),)) is used to get the visible cells only in the range A2:A10. The RANK.AVG function is then used to rank the values in the visible cells.
The IF statement at the beginning checks if the value in A2 is zero. If it is, the cell is left blank. If not, the ranking is calculated as described above.
You can adjust the formula to fit your specific data range and requirements.