I want to subtract a large number of small number by Visual Basic or a macro in Excel where the result will be a smaller number.
Example
1000-12 = 4
2000-7=5
This result appears when pressing ENTER or (=) key several times.
Is there a way in excel or a software for this process gives us the result directly without pressing the Enter or (=) key a few times?
many thanks in advance for all.
I think you are referring to the remainder when the larger number is divided by the smaller number. The function for this is usually called mod. mod(m,n) gives the remainder when m is divided by n. So mod(1000,12) = 4 and mod(2000,7) = 5. This function is in Excel.
many thanks Alan
it's right.
How do I put code in Visual Basic in Excel by this function ( mod )
The first box: any number
The second box: small number (4,7,12)
The third box: result .
FIRST | write any number here |
SECOND | write 4 or 7 or 12 |
RESULT |
You don't need to write a VBA macro, you can just do something like the following directly in the spreadsheet:
In the above you write =MOD(C3,C4) in cell C5
.
thank u very much (Genius*Creative=Alan)
I have done this way and actually succeeded.
But the problem is if the number is up to 100, so that Excel 2013 sometimes does not accept more than 20 or 14 number in one cell.
Example:
5124536552325647895698745789654789654
(Not possible in Excel to show this number)
-
12
= #NUM (this code sometimes appears when a significant number ).
I want the code for Visual Basic in Excel so that you can subtract any number, even up to 1000 number from a smaller number.