+ Reply to Thread
Results 1 to 4 of 4

Worksheet as custom function?

  1. #1
    Registered User
    Join Date
    01-28-2011
    Location
    San Francisco area, California, US
    MS-Off Ver
    Excel 2003, 2007, 2010/2011
    Posts
    11

    Worksheet as custom function?

    Hi --

    I (newbie) have giant worksheet (in Excel 2003; 10 column x 50,000+ rows).

    Basically, all it does is to take two input cells, and yield results in four other cells.

    In other words, changing the two input cells changes almost everything else on the worksheet, and the results are displayed in four cells at the bottom of the worksheet.

    Now I need to get results for 50+ different input scenarios, and post them all on a summary tab:

    InputA1 InputA2 OutputA1 OutputA2 OutputA3 OutputA4
    InputB1 InputB2 OutputB1 OutputB2 OutputB3 OutputB4

    Etc.

    Is there a way to turn my entire existing worksheet into a single custom function (or set of four custom functions, one for each output), so that if I use InputA1 and InputA2 as the input variables, I can get the outputs for that scenario?

    Then my summary tab would have a table of one row per scenario:

    InputA1 InputA2 OutFcn1(InputA1,InputA2) OutFcn2(InputA1,InputA2) OutFcn3(InputA1,InputA2) OutFcn4(InputA1,InputA2)

    Is this possible?

    It doesn't look like a pivot table or a vLookUp -- is it something else that is easy to do?

    I am stuck due to my limited knowledge and must get this sorted out fast -- Many Thanks!
    Last edited by burro; 11-10-2011 at 05:47 PM. Reason: Give specific title.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Worksheet as custom function?

    You could use a 2D data table (actually, four 2D data tables, one for each output).

    I can't imagine why you need 500,000 cells to process two inputs into four outputs, though.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    01-28-2011
    Location
    San Francisco area, California, US
    MS-Off Ver
    Excel 2003, 2007, 2010/2011
    Posts
    11

    Re: Worksheet as custom function?

    Quote Originally Posted by shg View Post
    I can't imagine why you need 500,000 cells to process two inputs into four outputs, though.
    Thanks.

    The inputs basically select a time-frame -- start date and end date -- on a massive amount of time-series data.

    The outputs depend on the data in the specified time-frame.

    [But determination of the output is a little complex. For example, data in one column will be summed only once a running total in another column reaches a certain threshold, etc.]

    Anyway -- I've got the algorithm worked out to correctly generate outputs once the two input dates frame the time period.

    What I need is to be able to build a table of the two input dates and four output values for many different input date pairs.

    I could fill out such a table by hand, copying over the four output after inputting each pair of input dates, but that is tedious and error-prone.

    So I'd like some way to treat the whole worksheet as a function or set of four functions:
    e.g.
    OUTPUT1(date1,date2)
    OUTPUT2(date1,date2)
    OUTPUT3(date1,date2)
    OUTPUT4(date1,date2)
    or
    OUTPUT1(date1,date2)=OUTPUTS(1,date1,date2)
    OUTPUT2(date1,date2)=OUTPUTS(2,date1,date2)
    etc.

    That way, each row in my scenarios table, with one row per scenario (i.e. per pair of date inputs) would be:

    date1 date2 OUTPUT1 OUTPUT2 OUTPUT3 OUTPUT4

    where the outputs are functions of the dates, and the outputs are generated by the existing worksheet.

    Does that make more sense?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Worksheet as custom function?

    The data table solution would look like this:

    Please Login or Register  to view this content.
    The dates in row2 would get substituted into one cell, the dates in col B into another cell, and the result for that combination returned to the body of the table.

    Since the table only shows one result, you'd need four tables.

    This is a built-in capability of Excel. See Help for Calculate multiple results with a data table
    Last edited by shg; 11-10-2011 at 08:29 PM.

+ 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