Formula/VBA code needed - something like Solver/Goal seek

Borndippy

New Member
Joined
Apr 8, 2010
Messages
31
I have a spreadsheet with 3 columns. One has forecast value, one has actual value and the third column shows the difference between the two.

I want to show the individual rows that have the largest differences so as to account for at least 90% of the total.

I added a 4th column that caluclates the difference as a percentage of the total difference and applies the following if statement

If the difference is less than a value input into another cell (say A10) then return 0%

I have a filter that excludes all the 0% results (this runs via a macro, as soon as I view the sheet it applies the correct filter).

I have a total adding up the results as a value in cell C70
I then manually tweak the value in cell A10 until I get an answer of 90% or higher in cell C70.

I can't get goal seek to work with this (although I've never managed to get goal seek to work so that's not very telling!). I need to repeat this exercise on 20 individual sheets in very tight time constraints (less than 10 minutes). Is there a better way of doing it than manually changing cell A10 until I get the answer I want?

Apologies for the long post, any assistance welcome. I am definitely an Excel user, not an expert.
 

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
I've done similar work with stock options.

Your goal is to get the sum of C1:C69 which is represented in Cell C70 = 90% by only changing the value in cell A10?

Using Goal Seek, (make sure it is installed) in excel 2007-2010 go to the Data Ribbon
Data > What-If-Analysis > Goal Seek...

Set Cell: C70
To Value: 0.9
By Changing: A10

Run and it is done in 2-10 seconds depending on the iterations required.

If you install the VBA component.

You can use
Code:
Public Sub Goal_Seek_My_Value()
    Range("C70").GoalSeek Goal:=0.9, ChangingCell:=Range("A10")
End sub

Cycle through the pages and you ought to be done.

If your cell c70 is calculated based on other macros, then you will have to pretend to do a goal seek through raw coding and loops + itterrations.

Regards,
jc
 
Upvote 0

Forum statistics

Threads
1,215,324
Messages
6,124,250
Members
449,149
Latest member
mwdbActuary

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