Simplified Example: column Routing/Transit Number is blank in the Transactions worksheet, a random Branch would come from the Branches worksheet
Transactions worksheet:
Name | Address | City | Province | Routing-Transit Number |
Anne | 123 Buckey Street | Vancouver | British Columbia | |
Joe | 346 Argyle Road | Victoria | British Columbia | |
Bill | 675 Rollie Avenue | Calgary | Alberta | |
Tom | 348 Gasper Road | Moose Jaw | Saskatchewan | |
Gill | 2218 Faber St | Tumbler Ridge | British Columbia |
Branches worksheet:
The Column Province has Named Ranges for all values as the # of rows is different per province: ALBERTA,BRITISHCOLUMBIA,SASKATCHEWAN,MANITOBA,ONTARIO
The Column City has multiple instances of the same city as some cities have multiple branches in each city, each branch is in its own row
Routing Number | Transit Number | Branch | City | Province |
401699 | 01699 | Signal Hill | Calgary | Alberta |
401719 | 01719 | Mount Royal | Calgary | Alberta |
401729 | 01729 | Memorial | Calgary | Alberta |
494090 | 94090 | PB Great Van | Vancouver | British Columbia |
494170 | 94170 | Fraser & 49th | Vancouver | British Columbia |
494190 | 94190 | Main & Pender | Vancouver | British Columbia |
494400 | 94400 | Coal Harbour | Vancouver | British Columbia |
494480 | 94480 | Burrard & Davie | Vancouver | British Columbia |
474348 | 74348 | Main | Moose Jaw | Saskatchewan |
474358 | 74358 | Wal-Mart | Moose Jaw | Saskatchewan |
I want to match each Province and then City in the Transactions the Columns City and Province in the Branches worksheet, once the Province and City are matched up, pull a random Branch, bringing the values of the Routing Number and Transit Number together, if no City is matched up, just pull a random city from the province, and then a random branch from that city if more than 1 branch.
Example: in the row Anne, a random Branch would be generated from the Province of British Columbia and the City matching Vancouver, this City has 81 Branches, so let's say randomly it pulls the branch located at Coal Harbour, 494400-94400 would be pulled into the column Routing/Transit Number in the Transactions Worksheet.
F2 would have 494400-94400 as the value
I tried, #REF error
=INDEX(INDIRECT(VLOOKUP(G2,ALLPROVINCES,'Branches'!$D$2:$F$2526,4,FALSE)),RANDBETWEEN(1,COUNTA(INDIRECT(VLOOKUP(D2,ALLPROVINCES$D$2:$D$2526,2,FALSE)))))
Simplified Example: column Routing/Transit Number is blank in the Transactions worksheet, a random Branch would come from the Branches worksheet
Transactions worksheet:
Name | Address | City | Province | Routing-Transit Number |
Anne | 123 Buckey Street | Vancouver | British Columbia | |
Joe | 346 Argyle Road | Victoria | British Columbia | |
Bill | 675 Rollie Avenue | Calgary | Alberta | |
Tom | 348 Gasper Road | Moose Jaw | Saskatchewan | |
Gill | 2218 Faber St | Tumbler Ridge | British Columbia |
Branches worksheet:
The Column Province has Named Ranges for all values as the # of rows is different per province: ALBERTA,BRITISHCOLUMBIA,SASKATCHEWAN,MANITOBA,ONTARIO
The Column City has multiple instances of the same city as some cities have multiple branches in each city, each branch is in its own row
Routing Number | Transit Number | Branch | City | Province |
401699 | 01699 | Signal Hill | Calgary | Alberta |
401719 | 01719 | Mount Royal | Calgary | Alberta |
401729 | 01729 | Memorial | Calgary | Alberta |
494090 | 94090 | PB Great Van | Vancouver | British Columbia |
494170 | 94170 | Fraser & 49th | Vancouver | British Columbia |
494190 | 94190 | Main & Pender | Vancouver | British Columbia |
494400 | 94400 | Coal Harbour | Vancouver | British Columbia |
494480 | 94480 | Burrard & Davie | Vancouver | British Columbia |
474348 | 74348 | Main | Moose Jaw | Saskatchewan |
474358 | 74358 | Wal-Mart | Moose Jaw | Saskatchewan |
I want to match each Province and then City in the Transactions the Columns City and Province in the Branches worksheet, once the Province and City are matched up, pull a random Branch, bringing the values of the Routing Number and Transit Number together, if no City is matched up, just pull a random city from the province, and then a random branch from that city if more than 1 branch.
Example: in the row Anne, a random Branch would be generated from the Province of British Columbia and the City matching Vancouver, this City has 81 Branches, so let's say randomly it pulls the branch located at Coal Harbour, 494400-94400 would be pulled into the column Routing/Transit Number in the Transactions Worksheet.
F2 would have 494400-94400 as the value
I tried, #REF error
=INDEX(INDIRECT(VLOOKUP(G2,ALLPROVINCES,'Branches'!$D$2:$F$2526,4,FALSE)),RANDBETWEEN(1,COUNTA(INDIRECT(VLOOKUP(D2,ALLPROVINCES$D$2:$D$2526,2,FALSE)))))
Hi,
Can you please clarify this \"if no City is matched up, just pull a city and then a Random branch from that City\"? do you mean here is a Random City from the list?
As in your above dataset of Branche's worksheet, there is NO city called Victoria. How would you like the results to appear?
Regards, Faraz Shaikh,
Microsoft MVP, Excel Expert, MCT, MIE
Hi,
Can you please clarify this \"if no City is matched up, just pull a city and then a Random branch from that City\"? do you mean here is a Random City from the list?
As in your above dataset of Branche's worksheet, there is NO city called Victoria. How would you like the results to appear?
Regards, Faraz Shaikh,
Microsoft MVP, Excel Expert, MCT, MIE
/discussions/edgeinsiderdiscussions/translation-problems/2963520/replies/3667857