I don't think you can extend a formula to the Excel.
However, it is possible to add a condition so that the formula only shows you the result in certain cases with an IF or several ifs depending on another column.
I published the condition as an image because otherwise Lynkoa would detect a virus attempt...
Want to exclude certain cells from the column? Astonishing, but let's admit it.
Either you subject the formula to conditions, as mentioned @sbadenis , but there must be a common point between the cells,
Either youcan enter the formula in the column (the formula that is supposed to have the most occurrences) and then select the cells (click and drag, or with ctrl, shift keys) to exclude, then enter what you want to display there, for example "-" or a different formula.