is 3 a factor?

MikeL

Active Member
Joined
Mar 17, 2002
Messages
488
Office Version
  1. 365
Platform
  1. Windows
Hi, I am using XL 2000.

I have a value in cell A1. In cell B1, I am trying to write a formula to determine if "3" is a factor of the value in cell A1. What could that formula be?

I was thinking of: If(A1/3."yes","no"), but I cant seem to put the correct equation after the division.

Thanks in advance.
 
Hi Barry:

Works fine by me ...
y030515h1.xls
ABCDE
2NumberToTest
33
4
5
6DaveEgress1
73yesyesyes
83.33yesyesyes
93.34nonono
104nonono
116yesyesyes
1212.666666yesyesyes
139.999998nonono
Sheet4


I think I see it -- in your post there is typo in the formula -- the formula in your post is ...

=IF(MOD(IF(MOD(AB7,1)=0,B7,B7*10^(LEN(MID(B7,FIND(".",B7),255))-1)),B$3)=0,"yes","no")

and the correct formula is ...

=IF(MOD(IF(MOD(B7,1)=0,B7,B7*10^(LEN(MID(B7,FIND(".",B7),255))-1)),$B$3)=0,"yes","no")
 
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
You can revise the Lookup version so that it works OK with
integer numbers #-#=0 - 1 yields -1 so number should be just * 1 not 0


=GCD(A7*(LOOKUP(LEN(A7)-LEN(INT(A7))-1,{-99999,0,1,2,3,4,5,6;1,1,10,100,1000,10000,100000,10000000})),3)=3
 
Upvote 0
O.K., Paddy D's formula seems to test out on the two different dividers in the two samples below. Now to figure out how to get a "yes" or "no" out of the TRUE or FALSE. I've got the second half figured out:

=IF((MOD(B7,$B$3)=0)=TRUE,"yes","no")

The first part I can't figure out. So far I've got this, which isn't working:

=IF((ISNUMBER(FIND(".",B7)),MOD((SUBSTITUTE(B7,".","")+0),$B$3)=0)=true,"yes","no")

And then, I'll have to combine the two. But that's for tomorrow, boys and goils. I'm off to la-la land. By the way, what ever happened to the OP? :eek:

Test with a value of 3
Keepers1.xls
BCDEF
2Numbertotest
33
4
5Formulaby:
6DavePattonEgress1YogiPaddyD
73yesyesyesTRUE
83.33yesyesnoTRUE
93.34nononoFALSE
104nononoFALSE
116yesyesyesTRUE
1212.666666yesyesnoTRUE
139.999998nononoFALSE
Sheet1


Test with a value of 4
Keepers1.xls
BCDEF
2Numbertotest
34
4
5Formulaby:
6DavePattonEgress1YogiPaddyD
73yesyesnoFALSE
83.33yesyesnoFALSE
93.34yesyesnoFALSE
104yesyesyesTRUE
116yesyesnoFALSE
1212.666666nononoFALSE
139.999998nononoFALSE
Sheet1
 
Upvote 0
Dave and Yogi, I didn't see your last posts until after I had worked on and posted PaddyD's formula. I'll look at them tomorrow morning, I'm too exhausted now, it's nearly 2 a.m., and I am getting along in years :D

Thanks for all the work you've put in on this, and you, too, Paddy & Egress. And where IS the OP?
 
Upvote 0
Thanks for all the discussion on this topic. The original formula posted using the MOD function was all I needed as I am just working with integers. Its been fun to follow this thread and I've learned way more than I ever needed about math theory, formulas etc. Thanks again.

MikeL
 
Upvote 0
Here's the result of my Omega-testing:

Two formulas to test whether various numbers (in column B) are evenly divisible by the test number (cell B3). Formulas are by Yogi Arnand and PaddyD of MrExcel. Tested O.K. with a dozen or so whole numbers, both positive and negative. Does not seem to work when "Number to test" is a decimal. For example, 3.33 returns "no" when it should return "yes" on the 3.33 figure in cell B8. But that's for another day.

Formulas in cells C7 & D7:
Yogi:
=IF(MOD(IF(MOD(B7,1)=0,B7,B7*10^(LEN(MID(B7,FIND(".",B7),255))-1)),B$3)=0,"yes","no")

PaddyD
=IF(IF(ISNUMBER(FIND(".",B7)),MOD((SUBSTITUTE(B7,".","")+0),$B$3)=0,MOD(B7,$B$3)=0)=TRUE,"yes","no")

Thanks, guys.
Keepers1.xls
ABCDE
2Numbertotest
33
4
5Formulaby:
6YogiPaddyD
73yesyes
83.33yesyes
93.34nono
104nono
116yesyes
1212.666666yesyes
139.999998nono
14
Sheet1
 
Upvote 0

Forum statistics

Threads
1,221,695
Messages
6,161,361
Members
451,699
Latest member
sfairbro

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