Absolute value with IF statement

beancounter

Board Regular
Joined
Oct 30, 2002
Messages
111
I have a forumula as below

=IF((M20-21>0+0)*(M20-21<41+0),M20-21,(M20-21)-40)

It seems to work but if the # in M20 is less than 61 I get a negative number. I don't want the forumula to return negative numbers. How do I change the formula to make negative #'s be zero?????

Thanks,
John :unsure:
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Code:
=IF(M20<61, 0, IF((M20-21>0+0)*(M20-21<41+0),M20-21,(M20-21)-40))
 
Upvote 0
Dave3009,

I'm trying to determine if a number M20 - 21 units is greater than 0 but less than 40.

If so I need M20 - 21, but if M20 - 21 is greater than 40, I need (M20 - 21) -40 and have that # either be positve or zero.

Hope that makes sense.

John
 
Upvote 0

Forum statistics

Threads
1,222,036
Messages
6,163,533
Members
451,842
Latest member
bdt

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