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?
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
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.
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.
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.
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:
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% ?
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).
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%?
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".
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.
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.
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.
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.
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?
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.
see the attachment. You will see that I have recorded two macros:
1) To insert a new row for new people. 2) To insert a row for new animals.
With regards to 1), I would like to create a macro that copies the contents of the row with the penultimate name in the people section, and for a new row to be inserted beneath the copied cell. Similarly, with regards to 2) I would like to create a macro that copies the contents of the row with the penultimate name in the animal section, and for a new row to be inserted beneath the copied cell.
The issue that I have is that the macros do not copy the penultimate cell in each section, but copy a particular row, say row 11 each time I want to insert a new animal. So if I had inserted numerous new rows for the people section, and subsequently wanted to insert a new row for the animal section, I press “crtl+sht+a” which copies the contents of row 11 and which is not the contents of the penultimate row for the animal section.
I'm trying to copy multiple rows with a macro. Below code lets me duplicate one row at the time and the duplicate is inserted just below the chosen row.
I´ve made a simple macro in order to make easier to add new rows in a table, by filling the cells with the new data.
The problem is that according to one of the fields, I´d like that macro to add multiple rows, with exactly the same information but numbering all these rows on this specific field from 1to the number I filled on the respective cell.
For example, I have beyond another fields that I´ve already filled, the field "Parcel" and "Total of Parcels". I filled parcel with number 1 and total of parcels with 5. Then I´d like the macro to add 5 rows with the "total of parcels" cells containing 5 on every row and the field parcel filled with number 1, 2, 3, 4 and 5, for each row created.
how they can be used to delete rows that meet multiple criteria, however all the examples I have found seem to be rather complex and personal to the individuals as opposed to being rather generic. Many people, including myself would find it useful to have a simplified generic answer that can be applied to all kinds of criteria. Such as if the data in column B = x and the data in column C = y delete the row. Here is my example.
SCENARIO EXAMPLE:
In column A - Date e.g. 05/02/2011, 06/02/2011 In column B - Day In column C - Time (in format 09:06:21) In column D – Service numbers dialled (70, 110, 224) two to three digits long
MACRO EXAMPLE:
Delete the row if the criteria in: Column D = 10, 40, 192 or 244 And Column C is between 09:00:00 and 16:00:00
macro code or at least a link to a thread that they think gives a scenario as simple as this.
I used the macro editor to create a "simple" macro to edit 7 rows of text. The steps were basic and simple - F2 key, backspace about 25 times, and down arrow then repeat these 3 steps 6 more times. The macro I got gave me the result of the very first cell as I was recording the macro. I think I remember the old Lotus 1-2-3 macro text - {edit}{backspace}{down}. Wish it were still that simple.
I am trying to figure out how to make a macro that can sort some numbers from Largest to Smallest within a specific range on multiple sheets. The range is only within column D starting with cell D11: (until the data ends) on all the sheets in my workbook (the number of sheets may change with time) except for Sheets: "A", "B" and "C".
In other words I want the sort to work on all sheets except the first 3 sheets which are named Sheet A, Sheet B, and Sheet C.
I have attached a spreadsheet for an example of what I am saying.
The item_description is a combination of XXX, Part_no and Part_description all clubbed randomly. ( So I cannot use text-to-columns to bifurcate them).
Now Sheet B contains the part_number as follows :
SlNos, Part_no, ….,….,
I need a macro ( a procedure / function ) in Excel-vba, which would select each part_no in sheet – B one by one, find all those rows in which it appears in Item_Description column of Sheet-A and add a comment in the next column to it.
The Vlookup function cannot be used as it is not an exact match as the part_no is embedded among other things in item_description.
I'm trying to figure out how to create a macro for a project at work. Basically, think of a spreadsheet with 5 tabs, but the information in Tab 1-Column D is the same in Tab-4 Column D and Tab-5 Column D. When I insert a row, though, I have to go to each tab, insert the row, and copy down the formulas from the row above to ensure the flow-through stays true. This can get very tedious.
Does anyone have a template or tips on a macro that would, in essence, work like this:
a) Highlight the row above which a row should be inserted b) Trigger the macro c) A row is inserted above the highlighted row in Tabs #1, #4 and #5 d) The information from the row above the inserted row is copied down to the new row in each of the three tabs.
Is it possible to move rows of data in a spreadsheet to multiple spreadsheet accordingly? I had lists of tasks in a single spreadsheet and i need to segregate the tasks for all my staff in serial while no duplication among all of them. For instance, i got 4 personals in my department and i need the 1st 4 tasks to be distribute to each of them and next 4 tasks accordingly. This is due to all tasks are equip with due date and i need to calculate how much time i need to accomplishing them. i'm used to manually move it and found it time consuming, so i was wondering if someone would instruct me where or how to achieve it by using a simple macro.
I have a report that I drop down into Excel that is a transaction report for securities. The data for each security is in two rows. I would like to write a macro that would sort each two-line group by a certain cell in the group. If I could make the macro request the number of rows and columns in each range and the cell address of the cell to sort by, I would be able to use this macro for many different reports. Also, there has to be some way of telling the macro where to begin and where to end. I have some experience with macros although generally I "Frankenstein".