Formula Help (Most likely Dynamic Array Needed)

Magoosball

Board Regular
Joined
Jun 4, 2017
Messages
70
Office Version
  1. 365
Hello -- Please see image attached. I'm using Microsoft 365. Thank you!!

I'm looking to write a formula in the Location Assigned (Column F) that produces the results I manually inputted in the Answer (Column G)

Basically I have a list of Locations and Jobs in column A and B. I'm trying to assign each person in column D to the location where the least people are currently based off their job in column E.
For example: Caitlin is a police officer. Mike was already assigned to South America. Therefor the least amount of Police officers are currently assigned to Africa, which is 0.


I can use multiple helper columns if needed. When I was trying to do this previously I was receiving a circular reference error because when I dragged down the formula in the location assigned column each answer was dependent on the assignment made in the previous row.

thank you for your help and let me know if you have any questions!
 

Attachments

  • Capture.JPG
    Capture.JPG
    92.4 KB · Views: 12

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
How about
Excel Formula:
=LET(f,FILTER($A$2:$A$8,$B$2:$B$8=E2),INDEX(f,MOD(COUNTIFS(E$2:E2,E2)-1,ROWS(f))+1))
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0
How about
Excel Formula:
=LET(f,FILTER($A$2:$A$8,$B$2:$B$8=E2),INDEX(f,MOD(COUNTIFS(E$2:E2,E2)-1,ROWS(f))+1))
Hi Fluff,

I have a slight modification and wondering if you could assist. See the attached Screenshot. Instead of assigning to the lowest location based off a count; I'd like to assign to The Lowest "Fill".

Column C is a value
Column D is
Excel Formula:
=COUNTIFS(I:I,A2,H:H,B2)
Column E =
Excel Formula:
=D2/C2

Basically i'm taking a current number assigned so far, dividing by an amount required, and assigning them to the lowest rate.

1693338481542.png



thank you!!
 
Upvote 0
What do you mean by the lowest fill?
Also please post your data using the Xl2BB add-in, rather than an image.
 
Upvote 0
What do you mean by the lowest fill?
Also please post your data using the Xl2BB add-in, rather than an image.
I mean the lowest percentage in the rate column E. Xl2BB addin below:

Question.xlsx
ABCDEFGHIJKL
1LocationJobNeededAssignedRateNameJobLocation AssignedAnswer
2North AmericaTruck Driver300%JohnTruck DriverNorth America
3South AmericaPolice Officer700%MikePolice OfficerSouth America
4EuropeFirefighter400%AmandaTruck DriverAsiaLocation Assigned formula in cell I2 should be the Location in column A that has the " Min Rate" in column E
5AsiaTruck Driver700%CaitlinPolice OfficerAfrica
6AfricaPolice Officer400%MarkFirefighterEurope
7AustraliaFirefighter800%JimFirefighterAustralia
8AntarticaTruck Driver1900%GusTruck DriverAntartica
9TaylorPolice OfficerSouth America
10HayleeTruck DriverNorth America
11SabrinaPolice OfficerAfrica
12MartinFirefighterEurope
13BethFirefighterAustralia
Sheet1
Cell Formulas
RangeFormula
D2:D8D2=COUNTIFS(I:I,A2,H:H,B2)
E2:E8E2=D2/C2
 
Upvote 0
But the formula I supplied gives what you have shown for the expected results.
 
Upvote 0
The result of I10 here in red should be Antartica because it has the lowest rate of Truck Drivers in column E of 5 %. There are 3 Truck Driver Locations, North America with a rate of 33%, Asia with a rate of 14% and Antartica with a rate of 5%. Antartica has the lowest rate of 5% so cell I10 should return Antartica. Currently the formula in cell I10 is returning North America

Question.xlsx
ABCDEFGHI
1LocationJobNeededAssignedRateNameJobLocation Assigned
2North AmericaTruck Driver3133%JohnTruck DriverNorth America
3South AmericaPolice Officer7229%MikePolice OfficerSouth America
4EuropeFirefighter4125%AmandaTruck DriverAsia
5AsiaTruck Driver7114%CaitlinPolice OfficerAfrica
6AfricaPolice Officer4125%MarkFirefighterEurope
7AustraliaFirefighter8113%JimFirefighterAustralia
8AntarticaTruck Driver1915%GusTruck DriverAntartica
9TaylorPolice OfficerSouth America
10HayleeTruck Driver
11SabrinaPolice Officer
12MartinFirefighter
13BethFirefighter
Sheet1
Cell Formulas
RangeFormula
D2:D8D2=COUNTIFS(I:I,A2,H:H,B2)
E2:E8E2=D2/C2
I2:I9I2=LET(f,FILTER($A$2:$A$8,$B$2:$B$8=H2),INDEX(f,MOD(COUNTIFS(H$2:H2,H2)-1,ROWS(f))+1))
 
Upvote 0
Currently the formula in cell I10 is returning North America
That's because you originally said it should & also showed that as the correct answer in post#7. It's very difficult to help when you keep changing things.
As the formula in col D is looking at col I you are going to get a circular reference when using col E to determine what is in col I
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,103
Members
452,379
Latest member
IainTru

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