Forum Discussion
Bill_Van
Sep 27, 2021Copper Contributor
How to display a percentage value only if greater than zero
What is the correct formula to use if I need the percentage of two different cells to be displayed in a third cell only if the value is greater than zero? And, if the value is less than zero, I need a "0%" to be displayed. Thank you for any help that can be given.
3 Replies
Sort By
- PeterBartholomew1Silver Contributor
Since I perform all Excel calculation with defined Names and array formulas, MAX is a bit of a no go.
= LET( percent, (new-base)/base, IF(percent>0, percent, 0))
That is, of course, unless I push the boat out and adopt the soon to be released Lambda functions with
= MAP(base,new, LAMBDA(b,n, MAX((n-b)/b,0)))
- Riny_van_EekelenPlatinum Contributor
Bill_Van That could be:
=(B1/A1-1)*--(B1>A1)
where B1 contains the value that should be greater that A1 for the formula to return a percentage other than 0%.