+ Reply to Thread
Results 1 to 5 of 5

Using Defined Variables in R1C1 Formula

  1. #1
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Using Defined Variables in R1C1 Formula

    So this is a pretty basic question I think that I often stumble with:

    I have three variables: YY, MM, DD. In one cell I want to insert the letters "DC" and then my 3 variables "YY", "MM", "DD", and then reference the cell 4 columns to the right so RC[4].

    With my attempt I get a ?NAME error and it produces the actual letters of "YY", "MM", "DD" instead of the variable assigned to those.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Using Defined Variables in R1C1 Formula

    What are the variable values and what is the manual entered formula? I usually quote the test formula as a comment before .Formula or .FormulaR1C1 so I can see if I get the string right.

    e.g.
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Using Defined Variables in R1C1 Formula

    Quote Originally Posted by Kenneth Hobson View Post
    What are the variable values and what is the manual entered formula? I usually quote the test formula as a comment before .Formula or .FormulaR1C1 so I can see if I get the string right.

    e.g.
    Please Login or Register  to view this content.
    The variable values are just the current date. So 17 for YY, 11 for MM, and 16 for DD. The cell 4 columns over is the number 01. So the result should be DC17111601

  4. #4
    Registered User
    Join Date
    08-08-2014
    Location
    Lancaster, PA
    MS-Off Ver
    2016 (windows & mac)
    Posts
    94

    Re: Using Defined Variables in R1C1 Formula

    try this

    FormulaR1C1 = "=""DC"" & " & YY & " & " & MM & " & " & DD & " & RC[4]"

    it's a bit of a minefield of "'s and &'s

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Using Defined Variables in R1C1 Formula

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

+ 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. Using R1C1 formula in VBA changes all references from CELL("address") function to R1C1?
    By dmasters4919 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-20-2014, 04:17 PM
  2. [SOLVED] Replace part of FormulaArray with R1C1 notation with defined variable
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2013, 11:02 AM
  3. Use of variables calculated in a R1C1 formula in VBA
    By Sousoudef in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2013, 11:06 AM
  4. R1C1 with variables and the Rank Function.
    By NicholasL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-01-2013, 11:24 PM
  5. Using named variables with R1C1 formatting?
    By jenlookxl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-14-2012, 07:44 PM
  6. [SOLVED] Trouble Including Variables in R1C1 VBA Code...
    By michaeljoeyeager in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-26-2012, 03:46 PM
  7. Sum between two defined variables (1st row - last row)
    By uncleslinky in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-15-2011, 06:34 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