Finding the Min and assigning to that category

Magoosball

Board Regular
Joined
Jun 4, 2017
Messages
70
Office Version
  1. 365
I have a spreadsheet with 2 separate sheets set up as follows

List
[TABLE="width: 500"]
[TR]
[TD]Department
[/TD]
[TD]Shift[/TD]
[TD]State[/TD]
[/TR]
[TR]
[TD]Home Health[/TD]
[TD]Nights
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Toys[/TD]
[TD]Nights[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Toys[/TD]
[TD]Days[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Sporting Goods[/TD]
[TD]Days[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Grocery[/TD]
[TD]Days[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Toys[/TD]
[TD]Nights[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Furniture[/TD]
[TD]Days[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Pets[/TD]
[TD]Nights[/TD]
[TD][/TD]
[/TR]
[/TABLE]

The goal of this is to look at the summary sheet below and populate the State column with the lowest value that matches the department and shift.

Summary sheet:
[TABLE="width: 500"]
[TR]
[TD]Department
[/TD]
[TD]Alabama[/TD]
[TD]Alabama[/TD]
[TD]Alaska[/TD]
[TD]Alaska[/TD]
[TD]Maryland[/TD]
[TD]Maryland[/TD]
[TD]Maine[/TD]
[TD]Maine[/TD]
[/TR]
[TR]
[TD]Pets
[/TD]
[TD]Days[/TD]
[TD]Nights[/TD]
[TD]Days[/TD]
[TD]Nights[/TD]
[TD]Days[/TD]
[TD]Nights[/TD]
[TD]Days[/TD]
[TD]Nights[/TD]
[/TR]
[TR]
[TD]Grocery[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]9[/TD]
[TD]4[/TD]
[TD]2[/TD]
[TD]34[/TD]
[TD]8[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]Garden[/TD]
[TD]5[/TD]
[TD]879[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]62[/TD]
[TD]154[/TD]
[TD]87[/TD]
[TD]52[/TD]
[/TR]
[TR]
[TD]Home Health[/TD]
[TD]1567[/TD]
[TD]79[/TD]
[TD]712[/TD]
[TD]3[/TD]
[TD]456[/TD]
[TD]78[/TD]
[TD]152[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]Cosmetics[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]65[/TD]
[TD]79[/TD]
[TD]8[/TD]
[TD]4891[/TD]
[TD]54[/TD]
[TD]568[/TD]
[/TR]
[TR]
[TD]Furniture[/TD]
[TD]45[/TD]
[TD]45[/TD]
[TD]878[/TD]
[TD]9[/TD]
[TD]8[/TD]
[TD]455[/TD]
[TD]657[/TD]
[TD]26[/TD]
[/TR]
[TR]
[TD]Toys[/TD]
[TD]126[/TD]
[TD]489[/TD]
[TD]897[/TD]
[TD]7891[/TD]
[TD]324[/TD]
[TD]348[/TD]
[TD]48[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]Sporting Goods[/TD]
[TD]87[/TD]
[TD]98[/TD]
[TD]7[/TD]
[TD]1[/TD]
[TD]56[/TD]
[TD]4897[/TD]
[TD]97[/TD]
[TD]321[/TD]
[/TR]
[/TABLE]

These aren't numbers on the summary sheet, they are a countifs statement taht counts the state column (C) from the summary sheet for that specific unit and shift. For example there are a count of 456 "Maryland" in column C on the summary sheet.

When a state is populated in the "List" Spreadsheet the formulas on the summary tab would add 1 to that department/state/Day field respectively. Therefor the next item in the list could be impacted from the previous item on the list.

Is this possible with a formula in the State cells on the List spreadsheet?

Thank you in advance!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Upvote 0
[MENTION]Peter_SSs thanks for moving sir..[/MENTION]

Hi Magoos,

This looks like its working ok, Note that Pets doesn't have values so the formulas start from Grocery.

Also I made a extra column for the Min so I could see at a glance that is working correctly;


Book1
ABCDEFGHI
1DepartmentAlabamaAlabamaAlaskaAlaskaMarylandMarylandMaineMaine
2PeriodDaysNightsDaysNightsDaysNightsDaysNights
3Grocery569423486
4Garden587945621548752
5Home Health15677971234567815212
6Cosmetics1265798489154568
7Furniture45458789845565726
8Toys1264898977891324348489
9Sporting Goods87987156489797321
Summary



Book1
ABCD
1DepartmentShiftMinState
2CosmeticsDays1Alabama
3CosmeticsNights2Alabama
4FurnitureDays8Maryland
5FurnitureNights9Alaska
6GardenDays4Alaska
7GardenNights5Alaska
8GroceryDays2Maryland
9GroceryNights4Alaska
10Home HealthDays152Maine
11Home HealthNights3Alaska
12PetsDays0Alaska
13PetsNights0Alaska
14Sporting GoodsDays7Alaska
15Sporting GoodsNights1Alaska
16ToysDays48Maine
17ToysNights9Maine
List
Cell Formulas
RangeFormula
D2=INDEX(Summary!$B$1:$I$1,,SUMPRODUCT((Summary!$A$3:$A$9&Summary!$B$2:$I$2&Summary!$B$3:$I$9=A2&B2&C2)*(COLUMN(Summary!$B$1:$I$1)-COLUMN(Summary!$A$1))))
C2{=MIN(IF(Summary!$A$3:$A$9&Summary!$B$2:$I$2=$A2&$B2,Summary!$B$3:$I$9))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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