# Adding OR to if formula

#### Brew

##### Well-known Member
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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

#### Yogi Anand

##### MrExcel MVP
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)

#### Brew

##### Well-known Member
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

#### Peter_SSs

##### MrExcel MVP, Moderator
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?

#### Brew

##### Well-known Member

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

#### Peter_SSs

##### MrExcel MVP, Moderator
Brew

Try this
=CHOOSE(L6,3,4,5,2,1)

#### Brew

##### Well-known Member
Thanks, that works

Replies
4
Views
100
Replies
5
Views
76
Replies
0
Views
102
Replies
9
Views
154
Replies
13
Views
408

1,136,926
Messages
5,678,610
Members
419,776
Latest member
mikelowski

### 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.

### Which adblocker are you using?

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

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