Divided by two numbers

robertdseals

Active Member
Joined
May 14, 2008
Messages
334
Office Version
  1. 2010
Platform
  1. Windows
I have a number and I want to see if it is divided by 10 and/or 8. 16 would because it can be divided by 8. 36 would because 2 10's and 2 8's. 17 would not because although you could get a 10 out of it, you wouldn't have enough left for an 8. Any thoughts?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
This description does not indicate an actual result that can be shown in an Excel cell.

Are you looking for a Yes or No to indicate whether a given number can be created by summing only 10's and 8's?

If that is correct, this sounds like an iterative problem that can only be solved by Solver or VBA. I don't think this can be done with formulas. What kind of solution are you open to?

What is the range of possible numbers? It might actually be easier to generate all possible numbers that meet your criteria up to your limit.

Cell Formulas
RangeFormula
C2:L2C2=B2+1
B3:L13B3=B$2*10+$A3*8
A4:A13A4=A3+1
 
Upvote 0
I have a number and I want to see if it is divided by 10 and/or 8. 16 would because it can be divided by 8. 36 would because 2 10's and 2 8's. 17 would not because although you could get a 10 out of it, you wouldn't have enough left for an 8. Any thoughts?
It sounds like you are looking for a TRUE result if the number can be divided by either 8 or 10 and FALSE otherwise. If that is the case...

=OR(MOD(A1,8)=0,MOD(A1,10)=0)
 
Upvote 0
It sounds like you are looking for a TRUE result if the number can be divided by either 8 or 10 and FALSE otherwise. If that is the case...
That was my first impression but the example
36 would because 2 10's and 2 8's.
36 is divisible neither by 10 nor 8, but can be made as a combination of sums of 10's and 8's.
 
Upvote 0
I would like to know if it can be divided by any combination of 10 or 8 or both.
 
Upvote 0
Your original description and your latest post, when taken together, are a little bit unclear to me. Let me ask this... what answer would you want for the numbers 18, 26, 28 and 34?
 
Upvote 0
Your original description and your latest post, when taken together, are a little bit unclear to me. Let me ask this... what answer would you want for the numbers 18, 26, 28 and 34?
Yes, because 10 & 8, yes because 10 and two 8's, yes because two 10's and an 8, yes because 1 10 and three 8's.
 
Upvote 0
Does this work for you
All this does is identify even numbers. The numbers 12, 14, 22, 32 should all fail but are TRUE from your formula.

I think the question worded very poorly* but I think what he really wants is clear. The number conforms if it can be calculated as 8x + 10y where x and y are non-negative integers.

@robertdseals you have not answered my question about the possible range of numbers. The simplest method is the lookup table that I already provided but I can provide a VBA solution if that is not adequate.

*None of these numbers can be divided by 8 or 10.
 
Upvote 0
Here is a UDF that returns TRUE or FALSE:

VBA Code:
Public Function EightTen(L As Long) As Boolean

   Dim i8 As Long
   Dim i10 As Long
   Dim Total As Long
   
   i10 = 0
   Do
   
      i8 = 0
      Do
         Total = i8 * 8 + i10 * 10
         If Total = L Then
            EightTen = True
            Exit Function
         End If
      
         i8 = i8 + 1
         
      Loop Until Total > L
      
      i10 = i10 + 1
      Total = 0
   
   Loop Until i10 * 10 > L

End Function
 
Upvote 0

Forum statistics

Threads
1,214,817
Messages
6,121,720
Members
449,050
Latest member
MiguekHeka

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