# Adding an OR condition to the MOD formula

#### Brew

##### Well-known Member
How do I update the following formula to add, or if "0", then the result is also "5"
=MOD(L7+2,5)

### Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

#### erik.van.geit

##### MrExcel MVP
Hi,

it would be good to study how to nest functions

check helpfiles for OR
OR(logic1, logic2, ....)

kind regards,
Erik

EDIT: deleted part of message which could be confusing

#### Brew

##### Well-known Member
Ive already tried a couple solutions, neither worked
=OR(L7=0,5,MOD(L7+2,5))
=if(L7=1,5,MOD(L7+2,5))
Anybody, have a working solution

#### erik.van.geit

##### MrExcel MVP
in fact when rereading your question, it can be interpreted in different ways
can you tell us in plain english what you are trying to do ?
and provide some examples

#### Brew

##### Well-known Member

ADVERTISEMENT

L7 can only be 1,2,3,4 or 5, so in L8 i want 2 increase the result in L7 by 2,
so the rule is if
L7=1, then L8=3
L7=2, then L8=4
L7=3, then L8=5
L7=4, then L8=1
L7=5, then L8=2

try
MOD(L7+1,5)+1

#### erik.van.geit

##### MrExcel MVP

ADVERTISEMENT

suddendly I understand what you were trying to do

your second formula was close
just replace "1" by "3"
=IF(L7=3,5,MOD(L7+2,5))

#### Brew

##### Well-known Member
Yep, that's it. thanks Erik

#### erik.van.geit

##### MrExcel MVP
you're WELCOME

the last clarification did the trick, you could have put this in your inital question

Replies
20
Views
299
Replies
0
Views
61
Replies
5
Views
206
Replies
1
Views
130
Replies
1
Views
177

Threads
1,136,510
Messages
5,676,281
Members
419,617
Latest member
Shane50GT

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

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