+ Reply to Thread
Results 1 to 3 of 3

Possible To Define A Generic Function In One Cell And Call This Function From Other Cells?

  1. #1
    Registered User
    Join Date
    05-02-2014
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    10

    Red face Possible To Define A Generic Function In One Cell And Call This Function From Other Cells?

    I have a question about whether or not you can define a generic function in one cell, then "call" this function from various other cells. Something like a function template which is a common feature in many software programming languages.

    Let's say I have an Excel spreadsheet for entering and calculating information about several different images, Width, Height, and Aspect Ratio. The Width and Height properties are entered manually, but the Aspect Ratio is calculated (Width/Height).

    The cells containing the Aspect Ratio for each image are not in any contiguous row or column due to the way I have laid out my cells.

    Here is a picture of what my image worksheet looks like:

    Images_Sheet.png

    http://i144.photobucket.com/albums/r...psbed1d4e2.png

    For each Aspect Ratio cell I could just enter the following formula(s):

    C5: = C3/C4
    C10: = C8/C9
    C15: = C13/C14

    But let's say I wan't to get fancy and define a formula for calculating the Aspect Ratio in another cell and then have each of the cells reference the formula indirectly. So, in another worksheet I create a formula table an in one of the rows I enter the following (I know the syntax is incorrect, I am just trying to demonstrate what I am after):

    D4: = w1/h1

    Where w1 and h1 don't reference an actual cell, they are more like parameters to the function.

    Here is a screenshot of my function worksheet:

    Formula_Sheet.png

    http://i144.photobucket.com/albums/r...ps4f802484.png

    Obviously this does not work as it is but I was wondering is there a way to do what I am trying to do? To define a generic function in one cell and call that function from other cells?

    Thank you,

    Jan

    P.S. I have attached my example spreadsheet to this post.
    Attached Files Attached Files
    Last edited by tackyjan; 06-03-2014 at 03:28 AM.

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Possible To Define A Generic Function In One Cell And Call This Function From Other Ce

    unsure why anyone would do it this way but it is ...plausible

    you could possibly use formula like
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    use name range = width1 and height1

    ps you cant use w1 or h1 as they pre-exist as actual cells references
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Possible To Define A Generic Function In One Cell And Call This Function From Other Ce

    i can also think of some offset/match/index combination that could work without technically knowing the exact cell reference but some relative cell reference to "IMAGE 1" for instance

    see attached example of what i mean for both solutions

    C5 using named range and column G for the combination formula
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 08-05-2013, 06:14 PM
  2. Replies: 2
    Last Post: 03-26-2013, 01:33 AM
  3. define merged cells - before save function
    By billkelley in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-19-2008, 07:56 PM
  4. [SOLVED] Using CELLS function to define RANGE funcion
    By Brian Barbre in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-03-2005, 08:20 PM
  5. [SOLVED] Macro - define cell range for a sum function
    By Fad in forum Excel General
    Replies: 2
    Last Post: 06-06-2005, 08:05 AM

Tags for this Thread

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