+ Reply to Thread
Results 1 to 14 of 14

Offset formula using active cell

  1. #1
    Registered User
    Join Date
    10-31-2012
    Location
    Christchurch, New Zealand
    MS-Off Ver
    Office 365
    Posts
    24

    Offset formula using active cell

    Hi, is anyone able to help me to get this equation to work. The reason for using ActiveCell is because it is part of a macro and the cell will vary.

    =(OFFSET((ActiveCell),0,-1))

    If anyone is able to help solve the problem that this equation forms part of that would be great too.
    It is in the VBA part of the forum called "formula-in-and-offset-cell-based-on-location-of-text" (Not allowed to post links yet)

    The VBA code on the post above is:
    Please Login or Register  to view this content.
    Intent: Go down column A until "Grand Total" found, then place formula in offset cell (0,2). The IF formula wants to reference a cell offset (0,-1) as part of the equation.

    Thanks all!!
    Attached Files Attached Files
    Last edited by Jed_c; 04-12-2020 at 09:10 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,409

    Re: Offset formula using active cell

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional.)


    And please provide a sample workbook. See the yellow banner at the top of the page.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    10-31-2012
    Location
    Christchurch, New Zealand
    MS-Off Ver
    Office 365
    Posts
    24

    Re: Offset formula using active cell

    Thanks, changes made. I want to delete my other post but cannot seem to.
    Last edited by Jed_c; 04-12-2020 at 08:42 PM.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,604

    Re: Offset formula using active cell

    I don't quite understand what you are doing, but here's a partial solution:
    Please Login or Register  to view this content.
    I don't know what Last refers to, it's not initialized in your code. Same for Cell.
    ACTIVECELL is not a worksheet function so you can't build a formula with that.

    Then there's: "... reference a cell offset (0,-1) ..." since you are looking in column A, you can't move to the left
    Last edited by protonLeah; 04-12-2020 at 10:01 PM.
    Ben Van Johnson

  5. #5
    Registered User
    Join Date
    10-31-2012
    Location
    Christchurch, New Zealand
    MS-Off Ver
    Office 365
    Posts
    24

    Re: Offset formula using active cell

    Hi, sorry about that, the origional post is on another part of the forum, and was trying to avoid duplicating. Trying to get the other one deleted.

    Its a mess as I have tried to manipulate something from another part of the macro. Most of the other macro's I have set up are from using the record function, so you could quite happily disregard it all together.
    I have Columns A & B, the length of which will vary, but the last value in Column A will be 'Grand Total', adjacent to which is a sum of the values in Row B. This has come from a subtotal function, but is now just text after a copy and paste.

    What I want to do is create a formula in the offset cell 0,2 relative to Grand Total. If Grand Total was in Cell A5, the formula would be in C5 "=B5=Sheet1!N55". The other problem is that "B5" will obviously vary depending on how many rows there are.
    The intent is to check that the total at the end of the macro still matches that from the original page.

    Does that make sense?
    Last edited by Jed_c; 04-12-2020 at 11:22 PM.

  6. #6
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Offset formula using active cell

    Please Login or Register  to view this content.
    And not clear why IF is here
    Please Login or Register  to view this content.
    the result is TRUE or FALSE also
    Last edited by BMV; 04-13-2020 at 01:31 AM.

  7. #7
    Registered User
    Join Date
    10-31-2012
    Location
    Christchurch, New Zealand
    MS-Off Ver
    Office 365
    Posts
    24

    Re: Offset formula using active cell

    Ok, so after the above couple of posts this is what I am now trying to run with no result?

    Please Login or Register  to view this content.
    The purpose of the IF is that TRUE and FALSE will be replaced with text. TRUE will be "Total Matches Original Value" and FALSE will be the opposite.

    Happy to get rid of the i=last part etc (I dont understand it anyhow) if there is a better way to do the search? Am I better using something like the search function?

    There will only be one "Grand Total"
    Last edited by Jed_c; 04-13-2020 at 12:58 AM.

  8. #8
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Offset formula using active cell

    Jed_c , The subject of thread is not about Grand Total searching.
    Is Grand Total row always last?

  9. #9
    Registered User
    Join Date
    10-31-2012
    Location
    Christchurch, New Zealand
    MS-Off Ver
    Office 365
    Posts
    24

    Re: Offset formula using active cell

    BMV, I have made a mess of this post.

    Grand Total will always be last, but the row it is on will vary. I am trying to create a formula offset from this using VBA

  10. #10
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Offset formula using active cell

    Sorry there was typo in the "Formula R1C1". it must me "FormulaR1C1"

    If you sure that Garnd Total is always present and it always last row then
    Please Login or Register  to view this content.
    If not then
    Please Login or Register  to view this content.
    If spreadsheet is not big then
    Please Login or Register  to view this content.
    Last edited by BMV; 04-13-2020 at 01:34 AM.

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,596

    Re: Offset formula using active cell

    The other thread has been closed and this one has been moved to the correct sub-forum. Don’t duplicate queries again.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  12. #12
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Offset formula using active cell

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  13. #13
    Registered User
    Join Date
    10-31-2012
    Location
    Christchurch, New Zealand
    MS-Off Ver
    Office 365
    Posts
    24

    Re: Offset formula using active cell

    Thanks all for the help, now running :-) That was the last part of the macro so great to have it finished!

    Hope you all had a great easter

  14. #14
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Offset formula using active cell

    Glad to help and good luck with your project.

    Thanks for rep+.

+ 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] VBA to transfer active cell value to another sheet with offset values
    By annazet in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-13-2020, 03:27 AM
  2. [SOLVED] Cannot paste formula into offset active cell
    By icyrius in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-09-2018, 11:52 AM
  3. copying cell values from an active row using the offset function
    By Maxwelll in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-20-2018, 01:27 PM
  4. Offset formula references (only active sheet's)
    By Grho in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-30-2018, 03:09 AM
  5. [SOLVED] Formula with offset from active cell and sum until blank cell
    By ArnolddG in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-27-2013, 03:15 PM
  6. [SOLVED] Userform to add data to active cell offset
    By Nitefox in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 2
    Last Post: 12-14-2013, 07:58 PM
  7. Running a different Active.Cell Offset.....
    By Kirtman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2012, 05:52 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