+ Reply to Thread
Results 1 to 12 of 12

Getting different formula outputs for different given inputs

  1. #1
    Registered User
    Join Date
    07-08-2013
    Location
    Irrelevant
    MS-Off Ver
    Excel 2010
    Posts
    15

    Getting different formula outputs for different given inputs

    Hi all,

    I have a worksheet I'll call TheFormulasheet for now. In this sheet cell A50 eventually gives an output based on a load of formulae and reference tables, and based on the values put in A10, A11, and A12. For multiple reasons it is not possible to edit anything in TheFormulasheet and it should therefore be considered read-only.

    Next to this I also have what I call TheDatabasesheet. It's a basic database with slightly over 20k records (rows), using row 1 as a header row containing field names. Now what I basically want for my records is that column M gives the output of A50 from TheFormulasheet when TheFormulasheet's A10, A11, and A12 are using the values in column X, column Y, and column Z in TheDatabasesheet.

    In programming language it would probably sound somewhat like this for the first record in column M:

    M2 = TheFormulasheet.A50, for when TheFormulasheet.A10 uses X2, and for when TheFormulasheet.A11 uses Y2, and for when TheFormulasheet.A12 uses Z2.

    Then I want to auto copy it down for my 20k records. Due to the complexity of everything happening inside TheFormulasheet it is not possible to simply copy the formula behind A50 and paste it for every record.

    I have already tried to Google this but I don't even know what this trick is technically called hence I probably haven't found any useful results yet. How do I pull this off?

    Thanks in advance!
    Last edited by Jay Pee; 07-08-2013 at 06:09 AM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Getting different formula outputs for different given inputs

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    07-08-2013
    Location
    Irrelevant
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Getting different formula outputs for different given inputs

    Sample Jay Pee.xlsx

    As you can see there is a sheet containing the price calculation. However, the actual price calculation of B8 is such a complex formula in the real situation and is also depending on such a large amount of other data and tables that it is simply not possible for us to move the formula away from its cell, B8 in this case.

    Now I currently have the sheet Database BEFORE and I want the info from the records filled in in the formula on the Price Calculation sheet to have the final outcome (the price in this case) show up like is the case in Database AFTER.

    Again, there can't be anything changed to the Price Calculation sheet nor is it possible to copy the formula from B8.

    Thanks for helping!

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Getting different formula outputs for different given inputs

    cant see that

  5. #5
    Registered User
    Join Date
    07-08-2013
    Location
    Irrelevant
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Getting different formula outputs for different given inputs

    What do you mean, can't see what? The attachment? I can open it fine..
    Last edited by Jay Pee; 07-08-2013 at 09:59 AM.

  6. #6
    Registered User
    Join Date
    07-08-2013
    Location
    Irrelevant
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Getting different formula outputs for different given inputs

    Anyone else maybe?

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Getting different formula outputs for different given inputs

    what you describe sounds like a data table but with three inputs which is not possible in excel. your only option I reckon would be a vba routine to perform the substitutions and enter the values in each cell in the database sheet
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  8. #8
    Registered User
    Join Date
    07-08-2013
    Location
    Irrelevant
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Getting different formula outputs for different given inputs

    Is there a more newbie-friendly guide you can direct me to which describes your solution? I have no clue about VBA stuff.
    Last edited by Jay Pee; 07-08-2013 at 10:25 AM.

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Getting different formula outputs for different given inputs

    not really-the code would be specific to your situation-but here is a sample of what you would need based upon your example workbook

    Please Login or Register  to view this content.

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Getting different formula outputs for different given inputs

    As you can see
    no i cant its not clear
    However, the actual price calculation of B8 is such a complex formula
    well how can i possibly guess what it is?
    why not just use the same formula structure in f2 of data?

  11. #11
    Registered User
    Join Date
    07-08-2013
    Location
    Irrelevant
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Getting different formula outputs for different given inputs

    Quote Originally Posted by martindwilson View Post
    why not just use the same formula structure in f2 of data?
    Because of the amount of vlookups within different tables in different XLS files it is picking its data from, and because of the fact that should the formula be altered in the future, the database sheets have to be updated manually as well.

    Also, in my example I stated 3 input cells and one formula (price calculation), however, the actual situation has 3 input cells and 4 formulae which are all cross-linked and based on each other. Theoretically possible to translate the formulae for every entry in the database, but an awful lot of work!

    Currently I'm trying the VBA method to have a macro fill my cells in the database.
    Last edited by Jay Pee; 07-09-2013 at 07:44 AM.

  12. #12
    Registered User
    Join Date
    07-08-2013
    Location
    Irrelevant
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Getting different formula outputs for different given inputs

    Joseph, by changing the rows/columns/cells you typed in the macro to the actual ones I managed to pull off exactly what I needed. Thanks for the help and for putting in explanations what each part of the macro does. Really aided in understanding.

+ 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