Goal Seek a Range Where the Total Variance of each Row and the Total Variance of each Column must be = 0

vbavirgin

New Member
Joined
Oct 5, 2011
Messages
12
Hi,

I will explain.See the table below
abcTOTALTARGETVARIANCE
R11123-1
R211220
R311211
TOTAL312660
TARGET2226
VARIANCE1-10

<tbody>
</tbody>

The total target of the rows and columns will always equal each other and the total of the range will always equal the total target

I need to be able to goal seek each variance to zero by changing the values in the range A1:C3 (in this example). The real data more like 50 by 20

The values in the range can be decimals.

I am lost on this one - I assume an array could be used but that is way over my head at present.

I would appreciate some help on this one.

Thanks
 

vbavirgin

New Member
Joined
Oct 5, 2011
Messages
12
Hi all,

I manged to find a solution. It is slow but it works

The formula in the range A1:C3 takes its value e.g. A1 and adds a number in G1 and a number in A7. G1 and A7 are the ByChanging values to seek the TargetValue of 0
Code:
Sub ProRate()
    Dim i As Long
    Dim j As Long
    
    For j = 1 To 3
    For i = 1 To 3
    Cells(i, 6).GoalSeek Goal:=0, ChangingCell:=Cells(i, 7) 'make variance =0 by adding a value in column 7
    Cells(6, j).GoalSeek Goal:=0, ChangingCell:=Cells(7, j) 'make variance =0 by adding a value in row 7
    Next i
    Next j
    
 End Sub
Am open to any other suggestions.
 
Last edited:

Forum statistics

Threads
1,082,369
Messages
5,365,049
Members
400,819
Latest member
Gossow

Some videos you may like

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...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top