Consulting

Results 1 to 5 of 5

Thread: Dragging Formula down through merged cells

  1. #1
    VBAX Regular
    Joined
    Sep 2020
    Posts
    62
    Location

    Dragging Formula down through merged cells

    In Sheet1 I want to drag a simple cell reference formula (=Sheet2!B4) down through some merged cells. But when I do that the formula changes by the number of rows that make up the merged cells. What I need is the reference only increase by one 1....rather than the number of rows the the merged cell is.

    On the attached example is the final outcome of what it should look like on Sheet1. I need a formula in column G to refence the list of Dates on Sheet2, in order as they're listed. So I need G4 in Sheet1 to pull what's in B4 on Sheet2 (1/5/2021), then when I drag the formula down on Sheet1 to the next merged cell, G8 will equal the next date on the list in column B in Sheet2 (which is cell B5 - 1/7/2021).

    Hope that makes sense.

    Thank you!
    Attached Files Attached Files

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    Well, most people here will tell you how evil merged cells are

    Like anything else, they have their uses (usually)

    If you have to use them, then the easiest way I can think of is to use a helper column

    Capture.JPG

    Maybe someone else will have a better idea
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,871
    In merged cells which include cell G4:
    =INDIRECT("Sheet2!B" & INT(ROW()/4)+3)
    copy down.

    Or likewise with:
    =OFFSET(Sheet2!$B$3,ROW()/4,0)

    or:
    =INDEX(Sheet2!$B$4:$B$8,ROW()/4)
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  4. #4
    VBAX Regular
    Joined
    Sep 2020
    Posts
    62
    Location
    Perfect thanks everyone!
    Last edited by twmills; 01-18-2022 at 01:57 PM.

  5. #5
    VBAX Regular
    Joined
    Sep 2020
    Posts
    62
    Location
    Quote Originally Posted by p45cal View Post
    In merged cells which include cell G4:
    =INDIRECT("Sheet2!B" & INT(ROW()/4)+3)
    copy down.

    Or likewise with:
    =OFFSET(Sheet2!$B$3,ROW()/4,0)

    or:
    =INDEX(Sheet2!$B$4:$B$8,ROW()/4)
    yes. I liked the Index one.

    That was perfect.

    Thanks so much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •