Quantcast
Looking For An Excel Equation - Beyond.ca - Car Forums
Results 1 to 15 of 15

Thread: Looking For An Excel Equation

  1. #1
    Join Date
    May 2006
    Location
    Calgary
    Posts
    808
    Rep Power
    19

    Default Looking For An Excel Equation

    Does anyone know how to setup an excel spreadsheet so that I can plug in an X number list of values and then a "target value" and have excel determine which numbers (from those I have entered) can be summed to give me my target?

    In case my above explanation isn't clear, here's a basic example.

    If I enter a list of numbers:
    10
    13
    18
    7
    14

    And a target of 20; I want excel to highlight (or do something else to notify me) that the only numbers from my list that will sum to 20 exactly (right to the penny) is the 13 and the 7.

    Any help would be much appreciated.
    Last edited by BrknFngrs; 11-08-2008 at 12:25 AM.

  2. #2
    Join Date
    Jul 2004
    Location
    Calgary
    My Ride
    FB6
    Posts
    718
    Rep Power
    20

    Default

    The best way is to write an while loop in macros or even if statements.

    BUT if you really would like to stick with regular functions I think you would be able to use the =IF() function and embed more IF() functions , but I think the maximum times you can embed is 5 or 6.


    for example:


    A1: 10
    A2: 13
    A3: 18
    A4: 7
    A5: 14

    =IF(A1+A2=20,"A1+A2", IF(A1+A3=20,"A1+A3", IF(.... etc.

    but I just realized that you can only do the first interval with this method. I guess you can have an equation for each number then do the round robin for each number. It would limit you to 5 or 6 numbers max though.

    You can obviously put your target number as a cell as well, that way you don't have to edit the equations.

    BUT I would stick with macros.

    :P
    Last edited by realazy; 11-07-2008 at 09:30 AM.

  3. #3
    Join Date
    May 2005
    Location
    NE Calgary, AB
    My Ride
    TDI
    Posts
    983
    Rep Power
    20

    Default Re: Looking For An Excel Equation

    Originally posted by BrknFngrs
    that the only numbers from my list that will sum to 20 exactly (right to the penny) is the 10 and the 13.

    Any help would be much appreciated.
    10 + 13 = 20?

    But ya... pretty much have to a recursive check with a macro.

  4. #4
    Join Date
    May 2005
    Location
    NE Calgary, AB
    My Ride
    TDI
    Posts
    983
    Rep Power
    20

    Default

    Actually... think I figured out another way if you're interested. PM me your email and I'll send you the excel file.

  5. #5
    Join Date
    Jan 2006
    Location
    Calgary
    My Ride
    Axis powers
    Posts
    2,486
    Rep Power
    24

    Default Re: Re: Looking For An Excel Equation

    Originally posted by megavolt


    10 + 13 = 20?

    But ya... pretty much have to a recursive check with a macro.
    uhh....

    he wants the spreadsheet to figure out which numbers from a range will equate to 20.. in this case it would be 7 and 13 not 10 and 13
    Sig nuked by mod.

  6. #6
    Join Date
    May 2005
    Location
    NE Calgary, AB
    My Ride
    TDI
    Posts
    983
    Rep Power
    20

    Default

    Try reading his original post again... and I thought I was tired...

  7. #7
    Join Date
    Mar 2003
    Location
    Calgary
    Posts
    5,498
    Rep Power
    27

    Default

    Originally posted by realazy
    The best way is to write an while loop in macros or even if statements.

    BUT if you really would like to stick with regular functions I think you would be able to use the =IF() function and embed more IF() functions , but I think the maximum times you can embed is 5 or 6.
    I've nested more than 5 or 6 if statements in a cell before.

    Writing a few lines of code in VBA would be your best bet.

  8. #8
    Join Date
    Nov 2007
    Location
    Cowgary
    My Ride
    AWOL
    Posts
    972
    Rep Power
    17

    Default

    Sounds complicated, pay an Asian kid to do your algebra homework for you instead...


  9. #9
    Join Date
    May 2006
    Location
    Calgary
    Posts
    808
    Rep Power
    19

    Default

    Thanks for all the help guys, I suspected macros or VB was the way to go but I'm not too familiar with either.

    Megavolt PM'd

  10. #10
    Join Date
    May 2005
    Location
    NE Calgary, AB
    My Ride
    TDI
    Posts
    983
    Rep Power
    20

    Default

    Ug... it's on the work laptop. I'll try to break it out later.

  11. #11
    Join Date
    May 2006
    Location
    Calgary
    Posts
    808
    Rep Power
    19

    Default

    ^^ Oh no problem, sorry it took me so long to respond; I was away from the computer all day.

  12. #12
    Join Date
    Nov 2002
    Posts
    3,680
    Rep Power
    25

    Default

    Some things to consider:

    - What if there's more than one solution?
    - Can the list of numbers grow or shrink?

  13. #13
    Join Date
    Jun 2008
    Location
    Calgary
    Posts
    724
    Rep Power
    16

    Default

    try www.mrexcel.com
    i joined the forum for on specific equation i was having trouble with
    and within the day i had my answer
    (mine was based on conditional formatting but still a tough question to answer)

  14. #14
    Join Date
    May 2005
    Location
    NE Calgary, AB
    My Ride
    TDI
    Posts
    983
    Rep Power
    20

    Default

    Email sent. The solution I sent should be scalable and pick out multiple solutions. But it will all depend on the ultimate use of this, which wasn't really made clear.

  15. #15
    Join Date
    May 2006
    Location
    Calgary
    Posts
    808
    Rep Power
    19

    Default

    ^^ Thanks for the sheet, I suspect it would work but I wonder if something with macros would work better for my specific needs.

    To clarify, it will be used to determine which values from a general ledger are making up an account balance. Ideally, I want to be able to copy a range of values from a general ledger into the sheet, input my target value (per financial statements) and have it tell me the possible combinations of items that will yield that value.

    So scalability is major concern, as well format as I want to be able to drop in a large set of numbers with just a simple copy and paste. Ideally, I'd love to have it tied to a "button" I can just push so it doesn't require changing settings/equations every time.

    I have a working sheet using the solver function in excel but its fairly "clunky". If anyone wants to see it or could possibly build a "button" into it just PM me and I can email it you.

    Thanks again for the insight.

    Originally posted by Dumbass17
    try www.mrexcel.com
    I'll try this as well, thanks.
    Last edited by BrknFngrs; 11-08-2008 at 12:32 AM.

Similar Threads

  1. fuel milage equation.

    By spikerS in forum General
    Replies: 13
    Latest Threads: 02-15-2008, 01:05 AM
  2. Microsoft Excel Question;

    By Wildcat in forum Computers, Consoles, and other Electronics
    Replies: 10
    Latest Threads: 10-15-2003, 11:06 PM
  3. Replies: 5
    Latest Threads: 08-12-2003, 10:25 PM
  4. Computer Trick II (for those that have excel 97)

    By Monster Hui in forum General
    Replies: 12
    Latest Threads: 04-04-2003, 12:37 PM
  5. microsoft excel???

    By Import_Girl in forum General
    Replies: 1
    Latest Threads: 03-31-2003, 01:40 PM

Posting Permissions

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