# "Goal Seek"ing a Pro

#### prideaside

##### New Member
Hi there,

Hoping one of you geniuses can help me out here.

What I need to find is "x" in the equation:
.1 = [b + (x*c)]/[a+x]
where "a", "b" & "c" are all numbers based on other formulas that happen in the sheet, so they are always changing but fixed at the time of finding "x".

To put that equation into words:
10% = [rejected_files + (files_to_deliver x rejection_rate)] / [delivered_files + files_to_deliver]

So essentially I need to find how many files I can expect to deliver before hitting the 10% rejection threshold. This gets factored in with a bunch of other file types with their own rejection rates ("rejected_files" and "delivered_files" are sums of all file types - 10% being the overall rejection rate) and I'll need to do this for all of them, but if I get one I can get them all.

I've been trying the Goal Seek with the following code (updating automatically whenever "Worksheet_Calculate"):
Code:
``````Private Sub CheckGoalSeek()
Static isWorking As Boolean

If Round(Range("T1").Value, 6) <> 0 And Not isWorking Then
isWorking = True
Range("U1").Value = "0"
Range("T1").GoalSeek Goal:=0.1, ChangingCell:=Range("U1")
isWorking = False
End If
End Sub``````
...where "T1" is the ".1" or "10%" and "U1" is the "x" I'm looking for (other cells between those complete the formula), but while it sometimes gives me the answer I'm looking for it also sometimes gives me wild answers.

I think if I can force Goal Seek to use integers in the changing cell it might give me what I'm looking for (can't deliver half a file). I've factored in ROUNDUP in reference to the changing cell which improved it a little bit, but still gives me many of the same problems. Solver doesn't want to solve this for me.

So what do you think? Any ideas out there? Also, if you can figure that out, maybe you can add this into it... I'd like the number returned to be the highest possible number to make the target cell <= 10%.

Thank you!

#### MickG

##### MrExcel MVP
Perhaps:-

X= [(0.1*A) -B]/(C-0.1)

#### prideaside

##### New Member
Hi MickG,
That's actually very close, but there's one problem (and it's my fault for not mentioning this in the novel I wrote)...

In my equation:
.1 = [b + (x*c)]/[a+x]
I should have written:
.1 = [b + (ROUNDUP(x*c,0))]/[a+x]

Since there's no such thing as delivering or rejecting a fraction of a file, this ROUNDUP throws a wrench into the math.

#### prideaside

##### New Member
no ideas out there?

1,082,316
Messages
5,364,491
Members
400,802
Latest member
RichBRich

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...