+ Reply to Thread
Results 1 to 3 of 3

Fill in cell based on relative position of other cell

  1. #1
    Registered User
    Join Date
    11-19-2018
    Location
    London
    MS-Off Ver
    1803
    Posts
    9

    Fill in cell based on relative position of other cell

    Dear all,
    I was wondering if it is possible to fill in a cell relative to the position of an other cell. The distance between the columns between the “anchor” cell and the cell that has to be filled is known. I was wondering if there is a simple way to this. I have made a small example in excel to show you what I mean. Right now my solution is placing an if function in every cell, but I doubt that this is the easiest way.

    Say that I have a daily schedule that varies every day, and the moment I eat dinner (for some the most important moment of the day haha) is my “anchor”. I know that at day 1, I wake up 12 hours before I have dinner, and watch a movie 3 hours after I had dinner. I know that in reality this is not important, but it is based on a production environment where it actually makes sense. Someone that can help me out? Thanks!

    Max
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,958

    Re: Fill in cell based on relative position of other cell

    This will work on your Sheet2, if the values in columns A to H are values, and the 'Dinner' entry is made in row 3, row 7, etc: (And the values to enter offset from it are two rows above, and the column differences are one row above, the row where dinner is entered) If your actual structure is different, then the code will need to be adjusted, but I hope you see the logic to the code....

    1) Copy this code.
    2) Right-Click the sheet tab of Sheet2.
    3) Select "View Code"
    4) Paste the code into the window that appears.
    5) Save the file as a macro-enabled .xlsm file.
    6) Make changes as needed


    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,406

    Re: Fill in cell based on relative position of other cell

    MaxTiger when you do this with the IF it is evident you are referencing A1:H6 of 'Sheet2'. Are willing to have M1:AK10 included in a formula?

    I believe I see a possibility for a formula solution if you are. It will be long and complicated due to the layout of both sheets, but doable.

    Before investing the time please let me know if that is acceptable or whether Bernie's macro does what you want.
    Last edited by FlameRetired; 12-03-2018 at 08:23 PM.
    Dave

+ 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: 7
    Last Post: 12-16-2016, 04:16 AM
  2. Paste info to cell in position relative to a named cell-Simpler than it sounds
    By mariosmk555 in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 05-06-2014, 01:07 AM
  3. Replies: 1
    Last Post: 04-19-2013, 03:42 AM
  4. Replies: 2
    Last Post: 04-04-2012, 11:00 AM
  5. Excel 2007 : Macro to fill in a relative position
    By OtisMardres in forum Excel General
    Replies: 3
    Last Post: 03-15-2011, 07:17 PM
  6. VBA - Selecting a cell based on relative position vs cell #
    By jago_ML in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-08-2007, 03:04 AM
  7. Replies: 2
    Last Post: 07-21-2006, 03:28 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