Macros code to return a list of numbers according to Specific Conditions

worded

New Member
Joined
Dec 16, 2019
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
4 numbers are to be picked at random from a bag containing numbers 1 to 20
For convenience purposes, said numbers are grouped as;
1 - 5
6 - 10
11- 15
16- 20

Numbers chosen in the Number Pattern (2101) means 2 numbers are chosen from numbers (1-5), 1 number from numbers (6-10), no number, i.e. 0 number from numbers (11 - 15)
and 1 number from numbers (16-20).

Let Type of numbers under consideration be e for (Even) number, o for (Odd) number and p for a (Prime) number.

What code in excel(macros) or Python such that chosen pattern, for example 2101 and Number Type
(eeop) will return a list of numbers that fit these conditions? then go on to repeat for another number pattern (1120) and number type (oepe).

For example Number Pattern; (2101) @ Number Type (eeop)
and
Number Pattern; (1120) @ Number Type (oepe) returns following number list;

Number Pattern (2101) @ Number Type (eeop)
02 04 09 17
02 04 09 19

Number Pattern (1120) @ Number Type (oepe)
01 06 11 12
01 06 11 14
01 06 13 14
01 08 11 12
01 08 11 14
01 08 13 14
01 10 11 12
01 10 11 14
01 10 13 14
05 06 11 12
05 06 11 14
05 06 13 14
05 08 11 12
05 08 11 14
05 08 13 14
05 10 11 12
05 10 11 14
05 10 13 14

Thank you in advance.
(P.S. - Im new to this platform...apologies in advance for any indiscretion)
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Search "excel" and "permutation" on the net. Maybe you can modify one of the hits you find to suit your need.
 
Upvote 0

Forum statistics

Threads
1,215,449
Messages
6,124,911
Members
449,195
Latest member
Stevenciu

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