+ Reply to Thread
Results 1 to 4 of 4

goal seek in a formula

Hybrid View

  1. #1
    Registered User
    Join Date
    02-12-2009
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2000
    Posts
    52

    goal seek in a formula

    goal seek in a formula

    because the goal seek tool only allows you to enter a value in the second box 'to value' and not reference a value already in a cell it makes it hard for large volumes of entries.

    how would i go about writing a formula that would cover this:

    set: M5 (formula in M5 = O5-N5-F5)
    To value: G5 (no formula in cell, just value)
    By changing cell: O5

    Thanks,

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: goal seek in a formula

    Hi,

    Goal seek can't be used in a formula, however, you could use VBA

        Range("M5").GoalSeek Goal:=Range("G5").Value, ChangingCell:=Range("O5")
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    02-12-2009
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2000
    Posts
    52

    Re: goal seek in a formula

    Brilliant, i tried that earlier but couldnt get it too work (im not great with macros) however i need to change this so it is relative reference, and I can't quite get this right.

    ActiveCell.GoalSeek Goal:=ActiveCell.Offset(0, -6), ChangingCell:=ActiveCell.Offset(0, 2).Range

    I know its around the goal bit i'm messing up, any idea though?

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: goal seek in a formula

    Close, you don't need the .range as activecell is already effectively a range.

    ActiveCell.GoalSeek Goal:=ActiveCell.Offset(0, -6), ChangingCell:=ActiveCell.Offset(0, 2)
    Please post your code in code tags in future, lest you suffer the wrath of the mods!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1