stumped on dividing up qty in numeric bin to Alpha bins

Harley78

Active Member
Joined
Sep 27, 2007
Messages
372
Office Version
  1. 365
Platform
  1. Windows
I am trying to figure out best way to divide up a quantity that are in numerical bins to the bins that are letter and need to be refilled.

Excel Workbook
ABCDEFGHIJKL
1MaterialMaterial DescriptionPlntBinSLBUnUnrestr.-use stockMinMaxPullFrom LocPull Amount
21001Flex Element321EA500  
31001Flex Element321EA000  
41001Flex Element1456EA000  
51001Flex ElementSMEA012Refill2
61001Flex ElementMEA024Refill4
71001Flex Element1320EA000  
81001Flex Element1321EA400  
91001Flex Element1457EA000  
101001Flex ElementCEA736  
Sheet2


Column K is were I want to place the number that is calculated from a numeric bin location and place in the row with a letter bin location

ie. rows 5 & 6 show refill is required and if you look at row 2 bin 321 shows 5 so i need to divide by the number of refills and place then next to it. in this case 2 and 3 in SM & M.

Is this at all possible?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Shouldn't you also show where the refills came from? What if refills come from more than one location?
 
Upvote 0
Yes sir, your correct! thanks. Now onto figuring out how.. :)
 
Upvote 0
Well, a few minutes of my lunchtime produced this VBA macro to do it:
Code:
Sub AllocatePulls()

    'initialize pointers
    pullposition = 2
    pullsofar = 0
    Range("K2:K10").ClearContents
    For Each c In Range("L2:L10")
        If c.Value > 0 Then
            ' we have found a pull amount
            'get amount from the current pull position, if possible
            pulledforcurrent = 0
            partpull = 0
            Do Until pulledforcurrent = c.Value
                    partpull = Application.Min((c.Value - pulledforcurrent), (Range("G" & pullposition).Value - pullsofar))
                    c.Offset(0, -1).Value = c.Offset(0, -1).Value & Range("D" & pullposition).Value & "(" & partpull & ")/"
                    pullsofar = pullsofar + partpull
                    If pullsofar = Range("G" & pullposition) Then
                        ' find next pull position and reset pullsofar
                        testamt = 0
                        Do Until testamt > 0
                            pullposition = pullposition + 1
                            If pullposition > 10 Then ' we are past end of data, so end
                                Exit Sub
                            End If
                            testamt = Range("G" & pullposition).Value
                        Loop
                        pullsofar = 0
                    End If
                    pulledforcurrent = pulledforcurrent + partpull
                    partpull = 0
            Loop
            If Len(c.Offset(0, -1).Value) > 0 Then
                If Right(c.Offset(0, -1).Value, 1) = "/" Then
                    c.Offset(0, -1).Value = Mid(c.Offset(0, -1).Value, 1, Len(c.Offset(0, -1).Value) - 1)
                End If
            End If
        End If
    Next
End Sub
... if you are interested. I've only done a little testing, but it's something you could use as a starting point.
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,242
Members
452,898
Latest member
Capolavoro009

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