Multiplying only the numbers that are greater than zero

Rnkhch

Well-known Member
Joined
Apr 28, 2018
Messages
578
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have a range of cells that contain variuos positive or zero numbers, and I want to calculate the geometric mean of the range, but I need a way to exclude the zeros. I tried to use the GEOMEAN function hoping it will ignore the zeros, but it didn't. I tried to write some kind of combination of IF and PRODUCT functions, but wasn't successful. And unfortunately the PRODUCTIF function doesn't exist yet.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]N1[/TD]
[TD]N2[/TD]
[TD]N3[/TD]
[TD]N4[/TD]
[TD]N5[/TD]
[TD]Geometric mean[/TD]
[/TR]
[TR]
[TD]4.6[/TD]
[TD]8.5[/TD]
[TD]9.2[/TD]
[TD]7.3[/TD]
[TD]0[/TD]
[TD]#NUM![/TD]
[/TR]
[TR]
[TD]3.9[/TD]
[TD]4.4[/TD]
[TD]9.1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]#NUM![/TD]
[/TR]
[TR]
[TD]2.3[/TD]
[TD]8.2[/TD]
[TD]1.7[/TD]
[TD]5.2[/TD]
[TD]4.6[/TD]
[TD]3.77529[/TD]
[/TR]
</tbody>[/TABLE]


Any help would be appreciated.

P.S. If there are zeros in the range of cells, they would appear at the rightmost column(s), if this info is of any help.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Thank you, but I keep getting the "#NUM!" error with your formula. (Could it be happening because the result of the outer IF statement is FALSE causing the GEOMEAN to not go through?)
 
Last edited:
Upvote 0
Thank you, but I keep getting the "#NUM!" error with your formula. (Could it be happening because the result of the outer IF statement is FALSE causing the GEOMEAN to not go through?)

Did you apply control+shift+enter? That is, press down the control and the shift keys at the same time, while you hit the enter key? If done successfully, Excel itself puts a pair of { and } around the formula in recognition.
 
Upvote 0
Thanks! I figured it. It was a bit tricky :) I realized I have to press
control+shift+enter while the cursor is still at the formula bar after typing the formula.
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top