Build Macro That Iteratively Runs Goal Seek?

Nov 7, 2012

I'm trying to build a macro that iteratively runs a goal seek, then reduces a certain value (Let's call it "Bogey") in a different cell by a small amount (note that changing Bogey will affect the desired goal seek value), then runs the goal seek again, reduces Bogey by a small amount again, etc etc, and keeps running in this loop, with the restriction on this loop being that a different cell, affected by Bogey--let's call it "Constraint"--doesn't drop below a certain amount.

View 5 Replies


ADVERTISEMENT

Goal Seek Macro For Multiple Rows

Jan 27, 2008

I am trying to get Goal Seek to seek a value on each row as such:

Project 1 : Value 1 : Goal Seek using Value 1
Project 2 : Value 2 : Goal Seek using Value 2
etc....

How do I create one macro that will pick up Value 1, 2 etc and then set the Goal Seek to that value automatically, since Value 1, 2, etc will already be available in a cell? Alternativley there could be a macro that just runs that a Goal Seek for all the rows at once?

View 2 Replies View Related

Goal Seek Macro Returning Negative Values?

Nov 8, 2011

I am trying to setup a macro to automate goal seek to calculate the required payment to meet a 12% IRR Lookback at the end of a 10 year period. The problem I am running into is that in multiple scenarios the required return is reached without any excess payment at the 10 year mark so it is returning a negative payment in the goal seek cell. In other words it's adjusting what might be a 13% IRR to a 12% IRR (the minimum return) by showing an expense at the end of the term. I need a way to set it to goalseek with a minimum of 0.

View 3 Replies View Related

VBA Goal Seek Macro To Calculate Specific Range Only

Nov 20, 2008

Is there a way to use goal seek in VBA that won't trigger a full model calculation?

I would like to (somehow) perform goal seek, but only recalculate range("A1:B50") say on a single worksheet (where both the input value and the final calculated value is included in that range), as opposed to calculating the whole model inbetween each iteration.

Also, all dependencies between the input value and the final calculated result are contained in that range.

View 5 Replies View Related

Goal Seek In VBA With Variables

May 30, 2009

Trying to automate Goal Seek using variables for the three arguments. It's working when I define the cells references & values within the code, but cannot figure out how using variables. I'm sure the example below is incorrect, but will give an idea what I need to accomplish:

GoalCell = Worksheets("Parts").Cells(DestRowID + 10, DestColID)
Value = Worksheets("ICA").Cells(CopyRowID + 13, CopyColID).Value
ChangeCell= Worksheets("Parts").Cells(DestRowID + 9, DestColID)

GoalCell.GoalSeek Goal:=Value, ChangingCell:=ChangeCell

View 9 Replies View Related

Goal Seek Formula

Sep 28, 2006

CSS = P divided by S.
PS Required is a number that needs to be added to both S and P to achieve target of 83%

The answer to the below = 5. But i dont know how to get it using a formula
(If 5 is added to S and P both, S will become 36 and P will become 30; 30/36 = 83.33%)

Name S P CSS Target PS required
Adam 31 25 80.65% 83.00% ?

View 9 Replies View Related

Goal Seek Cell B1 To Zero By Changing C1

Aug 15, 2008

I need to goal seek cell B1 to zero by changing C1.

Then, I need to goal seek cell B2 to zero by changing C2.

Then, I need to goal seek cell B3 to zero by changing C3.

...................

...................

I need to goal seek cell B100 to zero by changing C100.

I don't want to have to perform 100 different goal seeks. Is there a way to do them all at once?

View 10 Replies View Related

Using Goal Seek On Userform With Variables

Apr 6, 2013

Goal seek function

Code:
Worksheets("Sheet1").Range("Polynomial").GoalSeek _
Goal:=15, _ ChangingCell:=Worksheets("Sheet1").Range("X")

Is it possible to modify this such that I can use variables? For example, the variables are 'left term', 'right term' and 'sigma max' .

I want to set the value of the following equation 'left term - right term' to 0 by changing variable 'sigma max' Everything is done on the userform and not in the spreadsheet.

(Note: In spreadsheet format, the above query is equivalent to setting a cell which has a formula to 0 by changing the value in another cell, fairly simple).

View 3 Replies View Related

Seeking A Formula Instead Of Having To Use Goal Seek?

Jun 4, 2014

Say employee John Doe has a salary X. Giving him a salary raise Y (euro/dollar) induces a pension premium to be paid by the employer, on that amount.

The premium is (fixed) 17% of the part above a (fixed) treshold value of 3.750. On the part of the raise below the 3.750, the pension premium is (fixed) 4,35%.

E.g. having a salary of 3.600, with a raise of 400.
4,35% of (3.750 - 3.600 = 150) equals 6,525
And 17% of the remaining 250 equals 42,500
So the total premium is 49,025

But, I want to give a raise with a total cost of no more than 400. So, I use goal seek to find a raise that, together with te pension premiums equals 400.

In the example, with 3.600 as a salary to start with, that raise would be 358,10 Because the part below 3.750 stays the same and induces a premium of 4,35% of 150, being 6,525 and the remaining part is 208,10 at 17% is 35,377.

Proof: 358,10 + 6,525 + 35,377 = 400

The question is: is there a possibility to have a formula that calculates the (e.g.) 358,10 based on a salary to start with (e.g. 3.600), an aimed total cost (e.g. 400) and the fixed constants 3.750, 17% and 4,35%?

View 3 Replies View Related

Goal Seek With Complex Numbers

May 24, 2008

I'm trying to understand how complex numbers are handled/processed in Excel.
As related to my application, an interesting exercise would be to use Goal Seek w/s command to find the roots of the equation:
X^2 + 4 = 0
setting the (rounded) value in cell A2 to 0 by changing A1

A1:: 1+i
A2:: =COMPLEX(ROUND(IMREAL(IMSUM(IMPOWER(A1,2),4)),6),
ROUND(IMAGINARY(IMSUM(IMPOWER(A1,2),4)),6))
Obviously a conventional or direct use of Goal Seek wouldn't work since Excel treats complex numbers as text.

Perhaps, one should use Goal Seek twice in this case:
first: find the coefficient "a" for IMREAL(A2) = 0
second: find the coefficient "b" for IMAGINARY(A2) = 0
and the root would be "a+bi".

View 9 Replies View Related

Goal Seek VBA Syntax - With / Without Parentheses

Nov 25, 2008

I've been playing around with GoalSeek in VBA because of this thread and found something about the syntax that I don't understand.

If I want to find out whether GoalSeek worked, I can use

Ok = Range("B1").GoalSeek(Goal:=10, ChangingCell:=Range("A1"))
Debug.Print Ok
This requires parentheses around the GoalSeek arguments.

If I just want to do the GoalSeek, then I need

Range("B1").GoalSeek Goal:=10, ChangingCell:=Range("A1")
with no parentheses. Why? The Help says that GoalSeek returns True if it works, and the proforma syntax includes parentheses, but then the only example uses the syntax without parentheses.

View 9 Replies View Related

Multiple Cell Goal Seek

Jan 22, 2009

I need to use a Multiple Cell Goal Seek.

I used the code from this site.

Here is the ....

View 9 Replies View Related

Goal Seek Across Multiple Rows

Feb 12, 2010

Is there a way to "copy" Goal Seek acroos multiple rows?

I have used Goal Seek in the first row. However this spreadsheet is several
hundred lines long and using it like this is not practical.

I want to seek a goal value of 30% on the cell that I called “c”, and I want the result of the goal seek to be put in the cell situated on the same row, 6 columns before.

This is the code that I tried to write, registering and saving the “goal seek” operation for one row.

Is it clear enough?

What i wrote:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 12/02/2010 by Whirlpool Europe Srl
'
' Keyboard Shortcut: Ctrl+w
'
On Error Resume Next

For Each c In ActiveWorkbook
If cvalue < 0.3 Then

Range("c").GoalSeek Goal:=0.3, ChangingCell:=Range offset(c,0,-6)

Next c

End Sub

View 9 Replies View Related

Automatically Goal Seek Whenever Changes Are Made

Oct 18, 2003

I have created the following in an effort to automatically goal seek whenever changes are made to the cell C2.

Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Row = 3 And Target.Column = 2 Then
Range("D19").GoalSeek Goal:=Range("C2").Value, _
ChangingCell:=Range("D3")
End If
End Sub

As far as I know, the Macro is running all of the time? When I use goal seek manually it works fine. Assuming the above is running, when I change the value in C2 nothing happens. Does the fact that I have a three sheet workbook make any difference? I am sort of lost. By changing the value in C2 I want Excel to change the value in D19 to match C2 by adjusting D3.

Application.EnableEvents = False
Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Row = 3 And Target.Column = 2 Then
Range("D19").GoalSeek Goal:=Range("C2").Value, _
ChangingCell:=Range("D3")
End If
End Sub
Application.EnableEvents = True

Doesn't seem to work either. However, I don't really know if other settings in the workbook are correct.

View 9 Replies View Related

Goal Seek Automation On Range Of Cells

Apr 1, 2013

I wanted to set up a macro to automate goal seek on a range of cells. I've attached a short extract below of the spreadsheet I'm working on (the full one has a few thousand lines of data) which I hope illustrates what I'm trying to do.

jan
feb
mar
apr
may
jun
jul
aug
Avg
New Avg

0
0
0
0
0
0
0
0
0
0

34
20
43
43
43
43
43
43
35
39

[Code] ...........

View 3 Replies View Related

Populate Cells In A Matrix From Goal Seek Values Based On

Aug 5, 2009

wish to write an VB macro in Excel (2003) that populates a 6 row by 10 column matrix (for a 3 D graph) by inserting values from matrix row column headers in cells in another worksheet and using goal seek to derive a value which will be pasted in the respective cell in the 6X10 matrix

Specific example: Matrix (Row Headers A2 to A7, Column Headers B1 to K1, Cell values are in B2 to K7). Please note row and column headers are numerical values since this is for a 3D graph

Macro to be written

Pick a value (numerical) from row header A3 in Sheet A and paste it in cell B6 in another sheet (Sheet B). Pick anothet value (numerical) from column header D1 in Sheet A and paste it in cell B7 in Sheet B.

Run a goal seek scenario such that cell S10 in sheet B is equal to 50 by changing cell G8 in Sheet B

Copy the value chosen/optimised by Goal Seek from cell G8 in Sheet B and paste it in Cell D3 (which is the relevant cell for the values for intersection of headers A3 and D1) in Sheet A

Macro should populate all cells in the matrix in Sheet A (matrix cells to be populated are B2 to K7) in a similar fashion

The macro should be locked in to the cells which are either being copied from or pasted into so that it still references them even if new columns or rows are inserted.

View 10 Replies View Related

Advanced Goal Seek: Two Cells Missing Highlighted In Blue

May 8, 2007

I have the total sales for a company. Then I have four specific segments that fall under those sales. Two out of the four segments I have exact sales figures for. The other two segments I just have the year-end sales and the dollar increase in each quarter. Is there a way to solve in excel for the missing quarters. So each of the four segments would have to add up to the total sales for both the quarter and the year. I've attached my example spreadsheet too. There are two cells missing highlighted in blue but i'm going to try to obtain that data. provided i fill in those two blanks, is there way to back into the rest of this spreadsheet?

View 3 Replies View Related

Excel Goal Seek Function For Finding Values To Certain Decimal Place

Feb 17, 2010

Any function in Excel, that would allow me to have a unit cost price (for example: 0.5432) and then for a table of figures containing the pack sizes to determine the correct unit price that would allow all pack costs to be at 2 decimal places. I have included an example below:

My spreadsheet would look like the following:

Cell A1 (Unit Cost Price) = .5814
Cell A3 (Pack of 75 units) = .5814*75 = 43.605
Cell A4 (Pack of 80 units) = .5814*80 = 46.512
Cell A5 (Pack of 100 units) = .5814*100 = 58.14
and so on

I need some way of making cell A1 change to a value that will cause all cells A3 to A5 to be 2 decimal places or less.

View 3 Replies View Related

Loop Through And Name Each Cell Iteratively?

May 11, 2014

I am trying to find the function or code in order to loop through and name each cell in a range iteratively.

For Example,

Cells A1,A2,A3,A4 would need to be renamed

so in psuedo code

name cell a1 ag.1
name cell a2 ag.2
name cell a3 ag.3
name cell a4 ag.4

Most of the naming is done in string literals which I am not sure how to get passed using a loop.

View 2 Replies View Related

Looping A Macro To Build A Report

Jul 14, 2009

I have a very large workbook which includes 100 sheets (A) each containing fixed data relevant to one unit (n) (in this case n = a building; there are 100 buildings), a few sheets (B) containing parameters & settings, and then 1 main sheet (C) which does complex calculations pulling & combining data from sheets (A) based on the parameters in sheets (B). The workbook is so large, (100MB+) that it has to be set to calculate manually.

One of the settings in one of the sheets (B) dictates which building (n) is currently being looked at. As such, sheet (C) effectively builds a report for building (n) and so can report on just one building at a time, that building (n) being determined by a drop-down box listing all of the available buildings and that list is in turn defined in one of the sheets (B).

If I want to get a consolidated picture for all buildings I currently manually change the building choice (n) in the dropdown box, and then run a macro (m1) which updates the report to show what I want, selects the specific bits of the report I want and copies the selection, switches to a separate pre-formatted consolidation sheet I have created (D), jumps to the last row in that sheet, pastes values and then jumps back to Sheet (C).

I then need to manually change the selection (n) and then rerun macro (m1).

What I would like is another macro (m2), which automatically loops through the different values for (n) so that the whole process is automated. Then in a perfect world, perhaps even a separate macro (m3) which would give me a list of tickboxes so that I could select specific properties for which to run the report.

View 9 Replies View Related

Build Undo In Recorded Macro

Oct 2, 2006

I have recorded certain macros. But after executing macro 'Undo' do not work. How can I do it ?

View 3 Replies View Related

Iteratively Delete Rows From A Spreadsheet

Apr 13, 2009

I have a very large spreadsheet (about 50,000 rows, and to CM of columns) with blocks of data 20 rows high (rows 1-20 are from Building A, rows 21-40 are from Building B, etc). However, not every row in each block of 20 has information in it - some are just placeholders. For example, some blocks may have rows 1-18 filled with data while other blocks may have only 1-6 filled with data. I am interested in programming a macro that would delete the placeholder rows out of the spreadsheet based on a certain criteria. This would probably halve the size of my spreadsheet.

In faux-
For row i
i = 1 to 50,000
If Column B = #NA
Delete row i

Is this something that can be done with a macro, or do I need to go through all of these rows by hand? Obviously, I haven't programmed macros before (I've taken code and run it), but I've programmed in other languages (Java, C#). Could someone point me in the right direction?

View 4 Replies View Related

Conditional SumProduct To Evaluate Iteratively

Sep 18, 2009

I have two tables, one summary sheet which contains a list of 30 projects. The second sheet has the projects broken down by task and status ("on time" or "late"), so it has three columns (project, task and status). I am trying to add up the number of projects within each task that are either "on time" or "late" and put these in two columns, so that the sum of each together will always equal 30.

The trouble is that any given task can appear multiple times for a project, and if one instance of that task is late, I want to count the whole project late for that task. Here is a table of what I am trying to do:

Project Task Status
A1 MU On time
A1 MU Late
A1 FA On time
B2 FA On time
B2 MU On time
B2 MU On time

The desired result of this scenario is that under task "MU" I would show a count of 1 projects on time (B2), and one that is late (A1). For task "FA" I would show a count of 2 projects "on time" (A1 and B2) and none for "late"

I think that an array formula is needed where it assigns a 1 to a project and task that is on time, and a 0 if it is not, and then multiplies these figures for each project and adds them up.

View 9 Replies View Related

Build Macro Which Emails Specific Records?

Jan 13, 2013

I am trying to build a macro using two files. The file 'master data.xls' has student details in a table containing 10 column heads as attributes (roll, name, address, email etc). The file 'Student Profile.xls' has been formatted to show individual student details in the form of a report. I want to prepare a macro such that each time I enter a new record in the "master data.xls", the data from new entry is printed in the format as given in "Student Profile.xls" as a pdf file which is saved with a file name defined by "(roll number) (First Name) (Last Name)" and the same is emailed to the student's email ID as specified in the "master data.xls" with the mail containing an address to the student name (ex: Dear Tom) and a standard text message in the body.

View 1 Replies View Related

Build Windows 8 App Based On Excel Macro?

Feb 24, 2013

I write a excel file (with macros included) to tackle the datas regarding stock market.

The excel file encompasses some information about financial reports, and some functions (macro) like sorting and filtering.

I'm wondering if I can build it as an windows 8 App and put it on the App market.

Or, in other words, can I make a windows 8 App by the functions in Excel ?

Can I do that ?

View 1 Replies View Related

Creating A Macro, That Creates A New Button, Which Itself Runs A Macro..

Dec 15, 2009

I have a long complicated macro that processes a ton of data and gives the output in a new sheet. I then want to create new buttons (or some sort of user clickable triggers) on this new sheet that runs another macro.

I have got the actual adding of buttons in the sheet working, but I can't find a way to automatically assign macros to newly generated buttons during runtime. Is this even possible (or are there any clever tricks I could use to get around this?)

View 3 Replies View Related

Building Macro That Runs Another Macro Based On Certain Columns

Jun 6, 2012

Essentially, I am working with a database for a school and up until this point, each row matches up to a student with a bunch of information on them. One of these pieces of info is their parent's names. This is a much simplified look at things, but the screenshot below is a basic version of what everything looks like:

Now, the school wants me to split up the parents names from the student's and place them in their own row. I have recorded a macro to do this where you make the active cell the "full name" column for the row you want to expand, and then run the macro. Afterwards, up to two more rows are added, with the parent's names and some data copied. Below is a screenshot of what that looks like: (yellow is the new data generated, and blue is the active cell I marked to run the macro properly)

The issue is that there are thousands of these that need to be done, and I figured there is a way to do this with a macro. The issue is that not every row has parents names to expand out.

In layman's terms, I need a macro that will look at the two columns titled "Father's Name" and "Mother's Name" on each row of the spreadsheet and then, if there is any data in both or either of them, it should set the active cell to the "Full Name" column for that row then run the macro accordingly. After that it should repeat this all the way down, skipping any where neither of the columns have text in them

In the actual spreadsheet, the columns that need to be checked are AW and AX, and the column that needs to be set to the active cell before running the macro is B.

View 5 Replies View Related

Macro That Takes Workbooks Or Files And Runs Them Through Another Macro

Apr 25, 2007

i need to make a macro that takes workbooks or files and
runs them through another macro. i already have the 2nd macro
done and it is working perfectly i just need to know how to make the one
that finds the other files and runs them all through the macro i already made. My boss said that he will have about 150-200 files to run through this macro.

View 9 Replies View Related

Trying To Build A Macro Filter Based On Data In Either Of Two Columns

Jul 31, 2008

I created a contact list that incorporates buttons at the top of the page to sort the data based on two customer type columns (thanks to Richard for help getting this far!).

I am attaching the file so that it will be easier to take a look. Four of the five macros are working fine but the second one ("All Clients") filters on the premise that "yes" is answered in either of the two customer type columns. In other words I am trying to show the records that have "yes" entered in either of these two columns, not necessarily both columns.

View 9 Replies View Related

Macro Only Runs Once

Nov 28, 2009

I can't seem to find an answer for this, but as an alternative, on Worksheet Activate the code runs and places a 1 in Range("A1") and therefore the next time the macro will not run.

This works fine for me, but just thinking if somebody who doesn't know why the one is in A1 and deletes it this macro will run again on sheet activate.

Private Sub Worksheet_Activate()
Dim LR As Long
Dim rng As Range

If Sheets("Charts").Range("A1").Value = 1 Then Exit Sub

LR = Sheets("POD").Cells(Rows.Count, "B").End(xlUp).Row

With Sheets("Charts")
.Range("I129").FormulaR1C1 = "=ROWS(R1C1:R[-128]C[-8])"
Set rng = .Range("A129").Resize(, 10)
rng.Copy rng.Resize(LR - 4)...............

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved