Counting bins

karkas

Board Regular
Joined
Oct 17, 2007
Messages
170
Office Version
  1. 2013
Platform
  1. Windows
I would appreciate some help identifying and quantifying available bins that medications are stored in.

My spreadsheet is 22k rows, so I need an easy way to find drawers that are underutilized. I'm ultimately looking to add a column in each row that show #bins available in that drawer by %, so I can sort and find the ones that are more empty, unless someone can think of an easier way.

I have the following report, which displays drawer/bin use in the following way:
medication cabinet name (omni_stid)
cabinet section (cabinet)
zone (zone)
drawer number(drawer_num)

So in this example, you can see that the first 24 rows is a 24 bin drawer (draw_desc). The (omni_stid), (cabinet, zone), and (draw_num) all match, so that is one drawer, and the second drawer continues below with a "2" in the (draw_num) column. You can see if the respective bin in each drawer is utilized, by whether there is a medication name there in the (rx_name) column.

If a bin does not have an assigned medication, it will read "(Available)" in the (rx_name column). You can also see that final column (qty_onhand) shows the quantity currently loaded in that bin. I don't care how many are in the bin, only whether it has a medication assigned and quantity on hand.

In this example, there would be 0% available for the drawer Cabinet PB1W, cabinet 0, zone 1, drawer 1.

Thanks in advance for any help generating a formula to display bin availability!

omni_stidcabinetzonedraw_numdraw_descomni_binbin_numberrx_nameqty_parlvlqty_onhand
PB1W01124 Bin Locking336561CARVEdilol 6.25mg tab109
PB1W01124 Bin Locking336572phenyTOIN ER 100mg cap1612
PB1W01124 Bin Locking336583morphine IR 15mg tab108
PB1W01124 Bin Locking336594lactobacillus acidophilus tablet1513
PB1W01124 Bin Locking336605metoprolol succinate XL 50mg tab1011
PB1W01124 Bin Locking336616fludrocortisone 0.1mg tab512
PB1W01124 Bin Locking336627pregabalin 75mg cap106
PB1W01124 Bin Locking336638rivaroxaban 20mg tab53
PB1W01124 Bin Locking336649diazePAM 5mg tab511
PB1W01124 Bin Locking3366510HYDROcodone-aceta 10mg-325mg tab1516
PB1W01124 Bin Locking3366611HYDROcodone-acetam 5mg-325mg tab3016
PB1W01124 Bin Locking3366712methocarbamol 500mg tab1210
PB1W01124 Bin Locking3366813acetaminophen-ox 325mg-7.5mg tab1020
PB1W01124 Bin Locking3366914HYDROmorphone 4mg Tab1010
PB1W01124 Bin Locking3367015linagliptin 5mg tab53
PB1W01124 Bin Locking3367116losartan 50mg tab58
PB1W01124 Bin Locking3367217NIFEdipine ER/XL 90mg tab47
PB1W01124 Bin Locking3367318amoxicillin-clav 875mg-125mg tab64
PB1W01124 Bin Locking3367419glipiZIDE 5mg tab610
PB1W01124 Bin Locking3367520DULoxetine 30mg cap1013
PB1W01124 Bin Locking3367621NIFEdipine 10mg cap1013
PB1W01124 Bin Locking3367722atenolol 50mg tab86
PB1W01124 Bin Locking3367823ezetimibe 10mg tab86
PB1W01124 Bin Locking3367924folic acid 1mg tab810
PB1W01224 Bin Locking336161metoclopramide 10mg tab109
PB1W01224 Bin Locking336172metaxalone 800mg tab98
PB1W01224 Bin Locking336183cyancobalamin 1000mcg tab1011
PB1W01224 Bin Locking336194diltiaZEM CD 180mg cap56
PB1W01224 Bin Locking336205traMADol HCL 50mg tab2019
PB1W01224 Bin Locking336216zolpidem 5mg tab87
PB1W01224 Bin Locking336227amiodarone 200mg tab1615
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Thanks for the help, but I'm having trouble getting that to work. What is it supposed to be doing?

I think the comumns are messed up and that might be causing my problem. Here they are as they appear in my spreadsheet:
A = omni_stid
B = cabinet
C = zone
D = draw_num
H = draw_desc
K = omni_bin
L = bin_number
AD = rx_name
AF = qty_parlvl
AG = qty_onhand

Thank you!
 
Upvote 0
I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Also suggest that you investigate XL2BB for providing sample data & expected results to make it easier for helpers to understand just what you have & where it is and also what you want & where it is to be.

Any chance you could give us another (small) example or two (preferably with XL2BB) where the % available is not 0% and give explanation of the % calculation for that example too?
 
Upvote 0
Thank you Peter_SSs

I'm sorry for any confusion.

I updated my account details. Excel 2013 running in Windows 10.

Forgive my mistake. I actually posted the info from XL2BB, but I just chose the table only option. I moved the simplified data to another sheet. Here I chose "generate output" and got column and row info.

In this case, PB2NS, cabinet 0, zone 1, drawer 1 has 14 of 24 unused bins (58.3%), so I would like to add a column K that displays the 58.3%.


pharmacy drawer configuration by drawer bin2.xlsx
ABCDEFGHIJ
1omni_stidcabinetzonedraw_numdraw_descomni_binbin_numberrx_nameqty_parlvlqty_onhand
2PB2NS01124 Bin Locking336561ascorbic acid 500mg tab1027
3PB2NS01124 Bin Locking336572zinc sulfate 220mg cap1019
4PB2NS01124 Bin Locking336583famotidine 10mg tab208
5PB2NS01124 Bin Locking336594LORazepam 2mg/1ml 1ml vial55
6PB2NS01124 Bin Locking336605lacosamide 50mg tab65
7PB2NS01124 Bin Locking336616insulin 1unit/.01mL 10mL injecti10000
8PB2NS01124 Bin Locking336627(Available)00
9PB2NS01124 Bin Locking336638diazePAM 5mg tab57
10PB2NS01124 Bin Locking336649(Available)00
11PB2NS01124 Bin Locking3366510(Available)00
12PB2NS01124 Bin Locking3366611HYDROcodone-acetam 5mg-325mg tab2021
13PB2NS01124 Bin Locking3366712(Available)00
14PB2NS01124 Bin Locking3366813(Available)00
15PB2NS01124 Bin Locking3366914(Available)00
16PB2NS01124 Bin Locking3367015(Available)00
17PB2NS01124 Bin Locking3367116(Available)00
18PB2NS01124 Bin Locking3367217(Available)00
19PB2NS01124 Bin Locking3367318(Available)00
20PB2NS01124 Bin Locking3367419oxyCODONE IR 5mg tab3514
21PB2NS01124 Bin Locking3367520(Available)00
22PB2NS01124 Bin Locking3367621(Available)00
23PB2NS01124 Bin Locking3367722(Available)00
24PB2NS01124 Bin Locking3367823acetaminophen-oxy 325mg-10mg tab69
25PB2NS01124 Bin Locking3367924(Available)00
26PB2NS01224 Bin Locking336161(Available)00
27PB2NS01224 Bin Locking336172adenosine 3mg/1ml 2ml inj33
28PB2NS01224 Bin Locking336183zolpidem 5mg tab83
Sheet2
 
Upvote 0
Thanks for the help, but I'm having trouble getting that to work. What is it supposed to be doing?

I think the comumns are messed up and that might be causing my problem. Here they are as they appear in my spreadsheet:
A = omni_stid
B = cabinet
C = zone
D = draw_num
H = draw_desc
K = omni_bin
L = bin_number
AD = rx_name
AF = qty_parlvl
AG = qty_onhand

Thank you!

I would suggest a new tab that just shows your bins and the percentage then.
In K2 enter =concatenate(A2&"-",B2&"-",C2&"-",D2) and expand down the list (makes your bins as PB2NS-0-1-1 or PB2NS-0-1-2 etc)
On the new tab Copy all of K column as text and remove duplicates. Then next to that =SUM(COUNTIFS(Sheet2!$K$2:$K$28,Sheet3!A2,Sheet2!$H$2:$H$28,"(Available)",Sheet2!$J$2:$J$28,0)/COUNTIF(Sheet2!$K$2:$K$28,Sheet3!A2))
Expand that down and change the format to percentage.

Also it looks like when its available trhen quantity is 0 anyway so you may not need ",Sheet2!$J$2:$J$28,0"
 
Upvote 0
Thank you Marshy.

I wasn't quite able to get that to work in a single cell as you intended, but I was able to get it to work with a few extra columns this way:

1) Copied the original data (sheet named pharmacy drawer configuration b) to sheet 2 (on sheet 2 I removed all data except omni_stid column 'A'; cabinet 'B', zone 'C', draw_num 'D')
2) Concatenated omni+cabinet+zone+drawer# into (sheet named 'pharmacy drawer configuration b', column AK) and sheet 2 (column E)
3) On sheet2 column E (newly concatenated column), I removed duplicates to get one row per drawer.
4) on Sheet2 column F titled "Total bins" =COUNTIFS('pharmacy drawer configuration b'!$AK$2:$AK$22061,"=" & E2) and dragged down
5) on sheet2 column G titled "available bins" = =COUNTIFS('pharmacy drawer configuration b'!$AK$2:$AK$22061,"=" & E2,'pharmacy drawer configuration b'!$AD$2:$AD$22061,"=(Available)") & dragged down
6) on Sheet2 column H titled "percent available" = =G2/F2 and dragged down

Thanks for your help everyone!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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