# MOD function with range

#### hanssorling

##### New Member
Hi

I'm creating a worksheet in Excel from Microsoft Navision. I'm sorting out a number of items from the databas and keeping track of the range were the values will end up in the sheet. Once on the sheet I want to add a cell that checks if the values entered bys the user is possible to devide by three using MOD. I have med the formula =IF(MOD(E5;3)>0;"NOT OK") and that checks one cell. If I for example want to check the cells A1 or A2 or A3 if they can be devided by three I have to enter the formula after each other creating a very long string. There is a limitation in Navision and the will create an error if the string of formula is to long so I want the formula to check the cells I enter for the possiblity to be devided by three in some sim ple way. I can't create a script or anything like tha only a formula that will be entered in a cell. How can I do this?

Last edited:

### Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

#### Jonmo1

##### MrExcel MVP
Welcome to the board.

Try
=IF(SUMPRODUCT(--(MOD(A1:A3;3)>0))>0;"NOT OK")

#### hanssorling

##### New Member
Thank you and thank you for the answer.

The problem is that I want to check like this:

If A1 or A2 or A3 is not possible to devide with Three then NOT OK.

Did you try it?

#### hanssorling

##### New Member
I did now and it works perfect. Just gonna fix so it show a blank value when it is possible to devide by Three. Many many thanks!!!

#### Jonmo1

##### MrExcel MVP
You're welcome.

To make it blank instead of FALSE, try

=IF(SUMPRODUCT(--(MOD(A1:A3;3)>0))>0;"NOT OK";"")

Replies
8
Views
57
Replies
2
Views
92
Replies
4
Views
120
Replies
45
Views
1K
Replies
0
Views
24

1,127,354
Messages
5,624,195
Members
416,017
Latest member
moritz210

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