Select items at random based on date range

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
HelloWorld,


I have this challenge here with me and I need some help.


I want to look compare the day and month of the date in cell A2 with the date ranges below. Then when I find a match , I use that match to select at random one item from one of the arrays.


So if the match is seen in range A of the dates, then we select at random one item from arr(1).
If in date range B then arr (2)


In that order.




These are sample of date ranges :
Code:
A = 1st May – 30th June 
B = 1st July – 31st August 
C = 1st September – 31st October 
D = 1st November – 31st December 
E = 1st January – 29th February


Note :
These dates will be hard coded and will vary.


Say 23rd may – 17th June is a good example of what dates I will be using .


Only the day and month is needed here, the year is not needed in this situation.


My dates are in the format “dd-mm-yy”


These are the examples for the array I want to use :
Code:
Arr (1) = (“mango”, “apple”, “pear”, “orange”, “lime”)
Arr (2) = (“Tilapia”, “whale”, “Tuna”, “salmon”)
Arr (3) = (“Red”, “white”, “black”, “ash”, “violet”, “blue”, “green”)
Arr (4) = (“kia”, “hundai”, “Nissan”, “Toyota”)
Arr (5) = (“Dell”, “Lenovo”, “HP”, “Toshiba”, “Accer”)
 
No I am not ... I am just learning :)

Glad I could help
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

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