Using MOD and COUNTIFS to find if a number is divisible by a certain cell

jhgiants95

New Member
Joined
Jul 21, 2014
Messages
33
Office Version
  1. 365
Platform
  1. Windows
So this is difficult to explain so see the table below. Essentially I have a sheet with all of the products listed in each column and the number of cases ordered in the rows below as orders come in. The first row on the sheet lists how many cases there are in a pallet for that specific item. I'm looking to count the number of pallets that aren't "Full" meaning don't divide evenly.

There are hundreds of columns so I don't think is practical to use countif one by one. I cant figure out what configuration of mod and count if I can do to have this repeat for hundreds of columns across the sheet. Thanks for any help

Cases Per Pallet:40805030
Customer# "Non full Pallets"Item2Item3Item4Item5
Bill2 (since the only items that don't divide evenly are the Item2 and item4) - Item 3 is simply two full pallets4516010530
Todd0 - Since all are full pallets80320150150
Mark4 - all of these are partial pallets41350120100
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Maybe
Excel Formula:
=SUMPRODUCT(--(MOD(C3:F3,$C$1:$F$1)>0))
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Maybe
Excel Formula:
=SUMPRODUCT(--(MOD(C3:F3,$C$1:$F$1)>0))
I just updated my profile thanks I didn't know I could do that. I keep getting a DIV/0 error with this
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Maybe
Excel Formula:
=SUMPRODUCT(--(MOD(C3:F3,$C$1:$F$1)>0))
I'm troubleshooting now it works on about half the products and then when I set it to the full length I get the error
 
Upvote 0
Sorry for multiple replies. Your solution works and I figured out the problem - There are some empty cells that register as 0 in the first row - I can't figure out a working if statement to ignore those. Any ideas?
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Maybe
Excel Formula:
=SUMPRODUCT(--(MOD(C3:F3,$C$1:$F$1)>0))
 
Upvote 0
Do you have blank cells in the range?
 
Upvote 0
Ok how about
Excel Formula:
=SUMPRODUCT(--(IFERROR(MOD(C3:P3,$C$1:$P$1),0)>0))
 
Upvote 0
Solution
Perfect, Thanks so much I think I have a much better understanding of how this formula works now. Sumproduct seems to be the best way to solve most of the multiple counting across ranges. Also, learning about MOD and the double unary. Thanks again
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,825
Messages
6,121,787
Members
449,049
Latest member
greyangel23

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