Multiply cells but ignore zeros and blanks cells

New Contributor

How do I multiple numbers in different cells BUT ignore blanks and zeros. (Please not this a long excel sheet). I want to multiple all the numbers from cell A1:H1 and put the answer in cell J in total. The answer in the first cell should be 80 (1*2*5*2*2*2). 

However because I have zeros randomly through the work book a simple ** would not work.

I want a statement that reads, multiply cell however if zero or blank ignore.


10 72022  
10 42022  
4 Replies
best response confirmed by Excelstudent (New Contributor)

@Excelstudent If you are on a recent Excel version or on-line, this will work.


Or perhaps better to use:





 Then you capture everything except zeros and blanks.



An alternative could be this formula. Enter the formula with ctrl+shift+enter if you don't work with Office365 or Excel 2021.

multiply ignore zero and empty cells.JPG 


Using 365, I automatically go for a single dynamic range formula for the entire table.  The key is to replace zeros and blanks with 1 which is the identity under multiplication.

= BYROW(IF(data, data, 1),
    LAMBDA(row, PRODUCT(row))

If the Lambda function is named, this simplifies to

= BYROW(IF(data,data,1), Productλ)

... all of which looks nothing like Excel I realise!

Thank you very much for your help. This worked wonderfully.