Multiplying only the numbers that are greater than zero

Rnkhch

Well-known Member
Joined
Apr 28, 2018
Messages
528
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.

N1N2N3N4N5Geometric mean
4.68.59.27.30#NUM!
3.94.49.100#NUM!
2.38.21.75.24.63.77529

<tbody>
</tbody>


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

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
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,215,063
Messages
6,122,928
Members
449,094
Latest member
teemeren

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