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”)
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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