Both would ignore blanks. There was no mention of ignoring 0's, if that is a requirement then it will add to the complication.

The formula in column A below uses the second formula that I suggested previously, with an addition to allow for the number of values to be returned. The formula needs to be filled down adequately, as you are using excel 2019 you do not have the option of dynamic arrays.

Although it is possible the second method in column C is extremely unlikely to produce duplicates, however it does require a helper array (column L in the example) which must be a single row or column equal in size to the number of cells in the main array. I've only included the top part below, the formula is filled down to L61.

Any formula methods for what you are trying to do would be similar to one of these methods, anything without the additional column will mean a higher possibility of duplicates. If neither are suitable then the next step will be vba.