Subtraction generator formula | Randomly subtraction in excel

Aly01

New Member
Joined
Nov 23, 2014
Messages
33
Office Version
  1. 365
Hello,

I want to randomly subtract in excel using formula =RANDBETWEEN(1,9), but I don't want the result to be a negative number.
Example: 2 - 5 = -3 -> but I don't want that.
Can you help me? I'm not that good with excel ... :(
Thank you.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
If you don't want the result to be a negative number, use the ABS() function.

=ABS(2-5)
 
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’)

If you have the LET function then try ..

Cell Formulas
RangeFormula
A1:A10A1=LET(a,RANDBETWEEN(1,9),b,RANDBETWEEN(1,a),a&" - "&b&" = "&a-b)
 
Upvote 0
Thank you, but unfortunately I have no idea how to use LET formula.

1 digit subtraction.xlsx
ABCDE
1
24-9=
3
44-5=
5
68-9=
7
82-6=
9
107-5=
11
122-6=
13
Sheet2
Cell Formulas
RangeFormula
A2,C12,A12,C10,A10,C8,A8,C6,A6,C4,A4,C2A2=RANDBETWEEN(1,9)
 
Upvote 0
Thanks for adding your version details. (y)

unfortunately I have no idea how to use LET formula.
Just copy from my post (if you have TEXTSPLIT since you apparently want each bit in a separate cell)

22 12 18.xlsm
ABCDE
19-7=
22-1=
39-4=
48-2=
59-2=
61-1=
77-7=
82-1=
92-1=
109-5=
111-1=
Subtract
Cell Formulas
RangeFormula
A1:D11A1=LET(a,RANDBETWEEN(1,9),b,RANDBETWEEN(1,a),TEXTSPLIT(a&" - "&b&" ="," "))
Dynamic array formulas.
 
Upvote 0
if you have TEXTSPLIT
If you don't have TEXTSPLIT, then you could try this one.

22 12 18.xlsm
ABCDE
14-4=
26-4=
32-2=
43-3=
55-5=
66-4=
74-4=
89-6=
98-8=
107-6=
113-2=
Subtract (2)
Cell Formulas
RangeFormula
A1:D11A1=LET(a,RANDBETWEEN(1,9),b,RANDBETWEEN(1,a),MID(CONCAT(a,"-",b,"="),SEQUENCE(,4),1))
Dynamic array formulas.
 
Upvote 0
Solution
If you don't have TEXTSPLIT, then you could try this one.

22 12 18.xlsm
ABCDE
14-4=
26-4=
32-2=
43-3=
55-5=
66-4=
74-4=
89-6=
98-8=
107-6=
113-2=
Subtract (2)
Cell Formulas
RangeFormula
A1:D11A1=LET(a,RANDBETWEEN(1,9),b,RANDBETWEEN(1,a),MID(CONCAT(a,"-",b,"="),SEQUENCE(,4),1))
Dynamic array formulas.
It took me a while to figure it, but now it works. Both formulas works.
Thank you. Thank you. Thank you.
Thank you Peter.
 
Upvote 0
I agree. (y)
I didn't even bother to try that earlier as I was sure that column A would likely recalculate at the wrong time and create a number smaller than column C or that it would create some kind of endless recalculation. Just goes to show the need to actually test. 😎
 
Upvote 0

Forum statistics

Threads
1,215,039
Messages
6,122,802
Members
449,095
Latest member
m_smith_solihull

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