Random value from table with qualifier

jasonkgreen

Board Regular
Joined
Feb 21, 2013
Messages
50
I have a table of 1500 records. I want to populate a column with random states. My table with 1500 records has a region field already populated (Northeast, South, Midwest, West). I have another table with a list of the 50 states + DC each with a corresponding region (same as those listed above).

I found a formula that will return a random value from a list, but I need a qualifier to match the regions from each table and then return a random state where the regions match.

Suggestions?

=INDEX(data,RANDBETWEEN(1,ROWS(data)),1)

idcustomerrevenuesupportregionindustryState
1​
1​
$3,787​
3​
West
1​
Populate random state here
2​
1​
$1,734​
3​
South
2​
3​
2​
$2,126​
3​
West
1​
4​
2​
$2,259​
3​
West
2​
5​
2​
$1,587​
4​
Northeast
1​
6​
1​
$0​
4​
West
3​
7​
2​
$1,838​
4​
South
1​
8​
1​
$1,847​
4​
West
1​
9​
1​
$1,714​
2​
Midwest
3​
10​
2​
$1,718​
4​
South
3​
11​
2​
$4,388​
1​
West
1​
12​
2​
$3,155​
1​
Northeast
2​
13​
2​
$3,834​
4​
West
1​
14​
2​
$2,291​
4​
Northeast
2​
15​
2​
$4,140​
2​
South
2​
16​
2​
$2,194​
2​
South
3​
17​
2​
$2,938​
2​
South
1​
18​
1​
$3,313​
4​
Midwest
2​
19​
2​
$3,327​
4​
Midwest
3​
20​
1​
$1,449​
2​
Midwest
1​


Using this table (partial table shown)
StateState CodeRegion
AlaskaAKWest
AlabamaALSouth
ArkansasARSouth
ArizonaAZWest
CaliforniaCAWest
ColoradoCOWest
ConnecticutCTNortheast
District of ColumbiaDCSouth
DelawareDESouth
FloridaFLSouth
GeorgiaGASouth
HawaiiHIWest
IowaIAMidwest
IdahoIDWest
IllinoisILMidwest
IndianaINMidwest
KansasKSMidwest
KentuckyKYSouth
LouisianaLASouth
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I think this will help.

MrExcel posts20.xlsx
BCDEFGH
4idcustomerrevenuesupportregionindustryState
511$3,7873West1ID
621$1,7343South2
732$2,1263West1
842$2,2593West2
952$1,5874Northeast1
1061$04West3
1172$1,8384South1
1281$1,8474West1
1391$1,7142Midwest3
14102$1,7184South3
15112$4,3881West1
16122$3,1551Northeast2
17132$3,8344West1
18142$2,2914Northeast2
19152$4,1402South2
20162$2,1942South3
21172$2,9382South1
22181$3,3134Midwest2
23192$3,3274Midwest3
24201$1,4492Midwest1
25
26
27Using this table (partial table shown)
28StateState CodeRegion
29AlaskaAKWest
30AlabamaALSouth
31ArkansasARSouth
32ArizonaAZWest
33CaliforniaCAWest
34ColoradoCOWest
35ConnecticutCTNortheast
36District of ColumbiaDCSouth
37DelawareDESouth
38FloridaFLSouth
39GeorgiaGASouth
40HawaiiHIWest
41IowaIAMidwest
42IdahoIDWest
43IllinoisILMidwest
44IndianaINMidwest
45KansasKSMidwest
46KentuckyKYSouth
47LouisianaLASouth
Sheet26
Cell Formulas
RangeFormula
H5H5=INDEX(FILTER(C29:C47,D29:D47=F5),RANDBETWEEN(1,COUNTIFS(D29:D47,F5)))
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,215
Members
452,618
Latest member
Tam84

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