+ Reply to Thread
Results 1 to 5 of 5

Store Formula to variable

  1. #1
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Store Formula to variable

    Is this possible ?
    Store LEN(A2) to V1, like LEN(A2)=V1 then = MID(A2,V1,V1-1) ?
    Last edited by AliGW; 02-24-2018 at 02:24 AM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Store Formula to variable !

    Not sure without seeing a small sample worksheet with your before and after?
    HTH
    Regards, Jeff

  3. #3
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Re: Store Formula to variable !

    Example =MID(A2,LEN(A2)-3,5)
    I want to store LEN(A2)-3 to v1
    Then MID(A2,v1,5)

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Store Formula to variable !

    Can you post an actual sample in a workbook?

    With what you have asked, if you had the word "Geometry" in A2

    =LEN(A2)-3 returns 5

    The result of =MID(A2,V1,5) is "etry"

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Store Formula to variable !

    This is posted to Excel General, so I am not sure what your desired context or constraints are.

    In a very basic sense, if we see V1 as a cell reference (to V1), then one could store the formula =LEN(A2)-3 in V1, then your other cells/formulas can refer to the cell V1 whenever you want to use that value. This is the "unpopular" helper cell that I like to use so much.

    Another strategy that gets talked about is storing a named formula (which is just a more complicated variation of named ranges). http://spreadsheetpage.com/index.php...ng_techniques/ I don't use these at all, preferring to use helper cells, but other people sometimes like these.

    As a first guess, I think that one of those two techniques is what you are trying to describe.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ 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. [SOLVED] Formula to create store by store inventory transfers
    By DamianTaylor in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 04-08-2016, 08:37 AM
  2. Store result from formula array into variable
    By VitoBdG in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2016, 06:42 AM
  3. How to store a value of a variable so that it can be used later ?
    By yoursamrit2000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-27-2014, 03:29 PM
  4. Variable to store last row more than once.
    By bopsgtir in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-04-2012, 04:56 PM
  5. [SOLVED] Store variable in worksheet and use that variable in VBA code
    By ExcelGal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2012, 08:20 AM
  6. Store name as variable
    By james.90 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-18-2008, 12:22 AM
  7. store variable
    By keen learner in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-08-2006, 10:30 AM

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