I use Goal seek function in excel an wanted to automate it.
I have my goal hours in cell “G1” where I want to get all by picks completed by. In this example 5 hours.
I have in “ F3:F21” formula =$C$3*$E$3 and in cell “G3:G21” = =IFERROR(IF(D3>=C3,D3/F3,1),0)
When I use the Goal seek what if Analysis and enter the following :
Set Cell: G3
To Value: G1
By changing cell E3
When I do this for each cell everything calculates fine. It gives me how many pickers I would need to pick the Que Groups instructions for the Goal Hours to Finish Picks.
When I run my VBA look any numbers less then Hourly required to meet minimum are way off .
Here is both loops I tried:
UpdatedGoalSeek
<tbody>
[TD="bgcolor: #CACACA, align: center"]1
[/TD]
[TD="colspan: 3, align: right"]Goal Hours to Finish Picks
[/TD]
[TD="bgcolor: #C0C0C0, align: center"]5
[/TD]
[TD="bgcolor: #CACACA, align: center"]2
[/TD]
[TD="bgcolor: #FF9900, align: center"]Que
Group
[/TD]
[TD="bgcolor: #FF9900, align: center"]Min
Requirement
[/TD]
[TD="bgcolor: #FF9900, align: center"]Hourly
Required to Meet
[/TD]
[TD="bgcolor: #FF9900, align: center"]QueGroup
Instructions Breakdown
[/TD]
[TD="bgcolor: #C0C0C0, align: center"]No
of Pickers assigned
[/TD]
[TD="bgcolor: #FF0000, align: center"]Hourly
Picks Per Team
[/TD]
[TD="bgcolor: #666699, align: center"]Meeting
Min Hours Req to Complete
[/TD]
[TD="bgcolor: #CACACA, align: center"]3
[/TD]
[TD="bgcolor: #FFFFCC"]DSLA
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]162
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]27
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]27
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]27
[/TD]
[TD="bgcolor: #FFFF00, align: center"]1.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]4
[/TD]
[TD="align: right"]162
[/TD]
[TD="align: right"]27
[/TD]
[TD="align: right"]196
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]27
[/TD]
[TD="bgcolor: #FFFF00, align: center"]7.3
[/TD]
[TD="bgcolor: #CACACA, align: center"]5
[/TD]
[TD="bgcolor: #FFFFCC"]T300
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]162
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]27
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]110
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]27
[/TD]
[TD="bgcolor: #FFFF00, align: center"]4.1
[/TD]
[TD="bgcolor: #CACACA, align: center"]6
[/TD]
[TD="align: right"]162
[/TD]
[TD="align: right"]27
[/TD]
[TD="align: right"]160
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]27
[/TD]
[TD="bgcolor: #FFFF00, align: center"]5.9
[/TD]
[TD="bgcolor: #CACACA, align: center"]7
[/TD]
[TD="bgcolor: #FFFFCC"]T600
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]162
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]27
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]129
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]27
[/TD]
[TD="bgcolor: #FFFF00, align: center"]4.8
[/TD]
[TD="bgcolor: #CACACA, align: center"]8
[/TD]
[TD="align: right"]140
[/TD]
[TD="align: right"]23
[/TD]
[TD="align: right"]140
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]23
[/TD]
[TD="bgcolor: #FFFF00, align: center"]6.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]9
[/TD]
[TD="bgcolor: #FFFFCC"]TBULK
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]114
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]19
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]92
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]19
[/TD]
[TD="bgcolor: #FFFF00, align: center"]4.8
[/TD]
[TD="bgcolor: #CACACA, align: center"]10
[/TD]
[TD="align: right"]326
[/TD]
[TD="align: right"]54
[/TD]
[TD="align: right"]4
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]54
[/TD]
[TD="bgcolor: #FFFF00, align: center"]1.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]11
[/TD]
[TD="bgcolor: #FFFFCC"]TMEZZ
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]326
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]54
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]656
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]54
[/TD]
[TD="bgcolor: #FFFF00, align: center"]12.1
[/TD]
[TD="bgcolor: #CACACA, align: center"]12
[/TD]
[TD="align: right"]162
[/TD]
[TD="align: right"]27
[/TD]
[TD="align: right"]112
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]27
[/TD]
[TD="bgcolor: #FFFF00, align: center"]4.1
[/TD]
[TD="bgcolor: #CACACA, align: center"]13
[/TD]
[TD="bgcolor: #FFFFCC"]TTURR
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]120
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]20
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]49
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]20
[/TD]
[TD="bgcolor: #FFFF00, align: center"]2.5
[/TD]
[TD="bgcolor: #CACACA, align: center"]14
[/TD]
[TD="align: right"]326
[/TD]
[TD="align: right"]54
[/TD]
[TD="align: right"]53
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]54
[/TD]
[TD="bgcolor: #FFFF00, align: center"]1.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]15
[/TD]
[TD="bgcolor: #FFFFCC"]TYFIT
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]80
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]13
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]22
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]13
[/TD]
[TD="bgcolor: #FFFF00, align: center"]1.7
[/TD]
[TD="bgcolor: #CACACA, align: center"]16
[/TD]
[TD="align: right"]80
[/TD]
[TD="align: right"]13
[/TD]
[TD="align: right"]7
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]13
[/TD]
[TD="bgcolor: #FFFF00, align: center"]1.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]17
[/TD]
[TD="bgcolor: #FFFFCC"]TYTNK
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]80
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]13
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]1
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]13
[/TD]
[TD="bgcolor: #FFFF00, align: center"]1.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]18
[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFFF00, align: center"]0.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]19
[/TD]
[TD="bgcolor: #FFFFCC"][/TD]
[TD="bgcolor: #FFFFCC, align: right"][/TD]
[TD="bgcolor: #FFFFCC, align: right"][/TD]
[TD="bgcolor: #FFFFCC, align: right"][/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFFF00, align: center"]0.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]20
[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFFF00, align: center"]0.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]21
[/TD]
[TD="bgcolor: #FFFFCC"][/TD]
[TD="bgcolor: #FFFFCC, align: right"][/TD]
[TD="bgcolor: #FFFFCC, align: right"][/TD]
[TD="bgcolor: #FFFFCC, align: right"][/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFFF00, align: center"]0.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]22
[/TD]
</tbody>
Excel
and then this code :
tables to the web >> Excel Jeanie
HTML 4
Any one see what I am doing wrong with my code.
Do I need to code if, say D3 is less than C3 do not goal seek because any number less than gives me wrong long numbers.
Any help and direction as to what I am doing wrong is appreciated. Thanks
I have my goal hours in cell “G1” where I want to get all by picks completed by. In this example 5 hours.
I have in “ F3:F21” formula =$C$3*$E$3 and in cell “G3:G21” = =IFERROR(IF(D3>=C3,D3/F3,1),0)
When I use the Goal seek what if Analysis and enter the following :
Set Cell: G3
To Value: G1
By changing cell E3
When I do this for each cell everything calculates fine. It gives me how many pickers I would need to pick the Que Groups instructions for the Goal Hours to Finish Picks.
When I run my VBA look any numbers less then Hourly required to meet minimum are way off .
Here is both loops I tried:
UpdatedGoalSeek
A | B | C | D | E | F | G | H | |
ITTTQ | ||||||||
T500 | ||||||||
T700 | ||||||||
TDK2D | ||||||||
TPRCK | ||||||||
TUMEZ | ||||||||
TYPIP | ||||||||
<tbody>
[TD="bgcolor: #CACACA, align: center"]1
[/TD]
[TD="colspan: 3, align: right"]Goal Hours to Finish Picks
[/TD]
[TD="bgcolor: #C0C0C0, align: center"]5
[/TD]
[TD="bgcolor: #CACACA, align: center"]2
[/TD]
[TD="bgcolor: #FF9900, align: center"]Que
Group
[/TD]
[TD="bgcolor: #FF9900, align: center"]Min
Requirement
[/TD]
[TD="bgcolor: #FF9900, align: center"]Hourly
Required to Meet
[/TD]
[TD="bgcolor: #FF9900, align: center"]QueGroup
Instructions Breakdown
[/TD]
[TD="bgcolor: #C0C0C0, align: center"]No
of Pickers assigned
[/TD]
[TD="bgcolor: #FF0000, align: center"]Hourly
Picks Per Team
[/TD]
[TD="bgcolor: #666699, align: center"]Meeting
Min Hours Req to Complete
[/TD]
[TD="bgcolor: #CACACA, align: center"]3
[/TD]
[TD="bgcolor: #FFFFCC"]DSLA
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]162
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]27
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]27
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]27
[/TD]
[TD="bgcolor: #FFFF00, align: center"]1.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]4
[/TD]
[TD="align: right"]162
[/TD]
[TD="align: right"]27
[/TD]
[TD="align: right"]196
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]27
[/TD]
[TD="bgcolor: #FFFF00, align: center"]7.3
[/TD]
[TD="bgcolor: #CACACA, align: center"]5
[/TD]
[TD="bgcolor: #FFFFCC"]T300
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]162
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]27
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]110
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]27
[/TD]
[TD="bgcolor: #FFFF00, align: center"]4.1
[/TD]
[TD="bgcolor: #CACACA, align: center"]6
[/TD]
[TD="align: right"]162
[/TD]
[TD="align: right"]27
[/TD]
[TD="align: right"]160
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]27
[/TD]
[TD="bgcolor: #FFFF00, align: center"]5.9
[/TD]
[TD="bgcolor: #CACACA, align: center"]7
[/TD]
[TD="bgcolor: #FFFFCC"]T600
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]162
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]27
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]129
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]27
[/TD]
[TD="bgcolor: #FFFF00, align: center"]4.8
[/TD]
[TD="bgcolor: #CACACA, align: center"]8
[/TD]
[TD="align: right"]140
[/TD]
[TD="align: right"]23
[/TD]
[TD="align: right"]140
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]23
[/TD]
[TD="bgcolor: #FFFF00, align: center"]6.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]9
[/TD]
[TD="bgcolor: #FFFFCC"]TBULK
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]114
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]19
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]92
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]19
[/TD]
[TD="bgcolor: #FFFF00, align: center"]4.8
[/TD]
[TD="bgcolor: #CACACA, align: center"]10
[/TD]
[TD="align: right"]326
[/TD]
[TD="align: right"]54
[/TD]
[TD="align: right"]4
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]54
[/TD]
[TD="bgcolor: #FFFF00, align: center"]1.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]11
[/TD]
[TD="bgcolor: #FFFFCC"]TMEZZ
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]326
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]54
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]656
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]54
[/TD]
[TD="bgcolor: #FFFF00, align: center"]12.1
[/TD]
[TD="bgcolor: #CACACA, align: center"]12
[/TD]
[TD="align: right"]162
[/TD]
[TD="align: right"]27
[/TD]
[TD="align: right"]112
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]27
[/TD]
[TD="bgcolor: #FFFF00, align: center"]4.1
[/TD]
[TD="bgcolor: #CACACA, align: center"]13
[/TD]
[TD="bgcolor: #FFFFCC"]TTURR
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]120
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]20
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]49
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]20
[/TD]
[TD="bgcolor: #FFFF00, align: center"]2.5
[/TD]
[TD="bgcolor: #CACACA, align: center"]14
[/TD]
[TD="align: right"]326
[/TD]
[TD="align: right"]54
[/TD]
[TD="align: right"]53
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]54
[/TD]
[TD="bgcolor: #FFFF00, align: center"]1.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]15
[/TD]
[TD="bgcolor: #FFFFCC"]TYFIT
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]80
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]13
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]22
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]13
[/TD]
[TD="bgcolor: #FFFF00, align: center"]1.7
[/TD]
[TD="bgcolor: #CACACA, align: center"]16
[/TD]
[TD="align: right"]80
[/TD]
[TD="align: right"]13
[/TD]
[TD="align: right"]7
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]13
[/TD]
[TD="bgcolor: #FFFF00, align: center"]1.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]17
[/TD]
[TD="bgcolor: #FFFFCC"]TYTNK
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]80
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]13
[/TD]
[TD="bgcolor: #FFFFCC, align: right"]1
[/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"]13
[/TD]
[TD="bgcolor: #FFFF00, align: center"]1.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]18
[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFFF00, align: center"]0.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]19
[/TD]
[TD="bgcolor: #FFFFCC"][/TD]
[TD="bgcolor: #FFFFCC, align: right"][/TD]
[TD="bgcolor: #FFFFCC, align: right"][/TD]
[TD="bgcolor: #FFFFCC, align: right"][/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFFF00, align: center"]0.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]20
[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFFF00, align: center"]0.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]21
[/TD]
[TD="bgcolor: #FFFFCC"][/TD]
[TD="bgcolor: #FFFFCC, align: right"][/TD]
[TD="bgcolor: #FFFFCC, align: right"][/TD]
[TD="bgcolor: #FFFFCC, align: right"][/TD]
[TD="bgcolor: #FFFF00, align: right"]1.0
[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFFF00, align: center"]0.0
[/TD]
[TD="bgcolor: #CACACA, align: center"]22
[/TD]
</tbody>
Code:
Sub PickOptimizerGoalSeek()
Dim X As Integer
Dim i As Integer
X = Range("G1").Value
For i = 3 To 21
If Range("D" & i).Value <= Range("C" & i).Value Then
Range("G" & i).GoalSeek Goal:=X, ChangingCell:=Range("E" & i)
End If
Next i
End Sub
and then this code :
Code:
Sub PickGoalSeek()
Dim i As Integer
Dim j As Double
j = Range("G1").Value
For i = 3 To 21
If Range("D" & i).Value <> 0 Then
Range("G" & i).GoalSeek Goal:=j, ChangingCell:=Range("E" & i)
End If
Next i
End Sub
HTML 4
Any one see what I am doing wrong with my code.
Do I need to code if, say D3 is less than C3 do not goal seek because any number less than gives me wrong long numbers.
Any help and direction as to what I am doing wrong is appreciated. Thanks