Adding OR to if formula

Brew

Well-known Member
Joined
Sep 29, 2003
Messages
1,569
How do i update the following formula to add, OR if L6=0, then result is 5:
=IF(L6=4,1,MOD(L6+2,5))
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
How do i update the following formula to add, OR if L6=0, then result is 5:
=IF(L6=4,1,MOD(L6+2,5))

Hi dk:

One way would be to use ...

=IF(L6,IF(L6=4,1,MOD(L6+2,5)),0)

However, I hope you are not anticipating L6+2 resulting in becoming negative, because MOD() does not seem to work well then -- so in that case, I would suggest using ...

=IF(L6>0,IF(L6=4,1,MOD(L6+2,5)),0)
 
Upvote 0
Yogi, neither solution met the desired result. The problem is the result can only be 1, 2, 3, 4, or 5, so in L7 increased the result from L6 by adding +2, however if L6=4, then L7=1 or if L6=5, then L7=2
 
Upvote 0
Yogi, neither solution met the desired result. The problem is the result can only be 1, 2, 3, 4, or 5, so in L7 increased the result from L6 by adding +2, however if L6=4, then L7=1 or if L6=5, then L7=2
Brew, can you set out more clearly what the possible values in L6 can be and what the corresponding results you want are?
Is the formula only going to apply to L6? .. or will it be copied down or across?
 
Upvote 0
The formula will be copied down and will not apply only to L6.
example:
L6=1, THEN L7=3
L6=2, THEN L7=4
L6=3, THEN L7=5
L6=4, THEN L7=2
L6=5, THEN L7=1
 
Upvote 0

Forum statistics

Threads
1,214,426
Messages
6,119,417
Members
448,895
Latest member
omarahmed1

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