min amount formula exclude zero

Hi

I would like to modify the following formula to calculate the minimum value in a range of cells exclude zeros and
determine the max number of rows.
=SMALL((Q9:Q50000),INDEX(FREQUENCY((Q9:Q50000),0),1)+1)
I have set to a maximum of 50,000 rows
Thanks for your help
Ian
Ian BellretiredAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Raheman M. AbdulSenior Infrastructure Support Analyst & Systems DeveloperCommented:
try this
=SMALL(Q9:Q50000),COUNTIF($Q$9:$Q$50000,0)+1)

Open in new window


COUNTIF counts the zeros in the range plus 1 and informs SMALL to return the 'n'th smallest value.
Ian BellretiredAuthor Commented:
It works but if all the cells are zero it returns a #NUM error.
any suggestions ??
Ian
Raheman M. AbdulSenior Infrastructure Support Analyst & Systems DeveloperCommented:
Hope you used =small((
2 brackets as I missed one earlier
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Ian BellretiredAuthor Commented:
This is the formula you provided.
It has 2 opening and two closing brackets

=SMALL(Q9:Q200000,COUNTIF(Q9:Q200000,0)+1)

If all the cell contents contain zero then it posts the #NUM error
Excel amusantCommented:
Try this.

=IFERROR(SMALL(Q9:Q200000,COUNTIF(Q9:Q200000,0)+1),"")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rgonzo1971Commented:
Could you precise this

and  determine the max number of rows.
Ian BellretiredAuthor Commented:
Sorry for the delay replying. The formula works well
Thank You guys
Ian
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.