Pasting two formulas and using drag to increment

Techgique

New Member
Joined
Apr 26, 2022
Messages
15
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi all,

I've had some trouble figuring out what I had incorrectly assumed was an easy problem. I've built an excel document that I'm pretty proud of, but have reached a stopping point trying to fill two side-by-side formulas from different sheets to perform some calculations. I am on Excel 2019 and do not have the ability to access VBA functionality (work lockdown policy), so I am hoping there is a formulaic way to drag alternating formulas that increment by one every other cell. When I try the side-by-side copy, it increments (as expected) by 2 for each formula because it is skipping a spot. Is there a way to address this? I included an image for what I would like to do for a more basic approach that I could apply from other sheets, but for now trying to make it easy. Note that there are a lot of values to paste in, so manually entering would be a nightmare. To put it another way, I'm trying to sequentially pull values across a single row on one sheet and then sequentially pull values from a single row on another sheet, then have those show up alternating across a single row. Thank you for any help you are able to offer!
excel image example.PNG
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
In case it helps for clarity, the reality is A1:E1 and A2:E2 exist on different sheets and row numbers, just trying to see if this simple example is possible to paste in alternating values and then go from there.
 
Upvote 0
Welcome to the MrExcel board!

It depends what the formulas actually are, but here is a simple example. Enter the A5 & B5 formulas then select A5:B5 and drag the Fill Handle to the right.

22 04 27.xlsm
ABCDEFGHIJ
112345
2abcde
3
4
51a2b3c4d5e
Drag Formula
Cell Formulas
RangeFormula
A5,C5,E5,G5,I5A5=INDEX($A1:$E1,(COLUMNS($A:A)+1)/2)
B5,D5,F5,H5,J5B5=INDEX($A2:$E2,COLUMNS($A:B)/2)
 
Upvote 0
Thank you Peter, I ended up going with a single formula that was able to drag across here using Sheet1 and Sheet2 as examples and the ranges as examples. But it can be tailored to any sheet name and range:

Also note that you can surround it with IFERROR("",[ Formula ]) to remove any REF errors.

Thank you all!

Excel Formula:
=INDEX(IF(MOD(COLUMN(),2)=0,Junk!$A3:$E3,Junk!$A2:$E2),FLOOR(COLUMN()/2+0.05,1))
 
Last edited by a moderator:
Upvote 0
My sincere apologies, the Code button didn't seem to do what I expected, and the sheet names I was actually using didn't update. Here is the plain single formula I used for alternating from different locations:

=INDEX(IF(MOD(COLUMN(),2)=0,Sheet1!$A3:$E3,Sheet2!$A2:$E2),FLOOR(COLUMN()/2+0.05,1))
 
Upvote 0
Solution
Here is the plain single formula I used for alternating from different locations:

=INDEX(IF(MOD(COLUMN(),2)=0,Sheet1!$A3:$E3,Sheet2!$A2:$E2),FLOOR(COLUMN()/2+0.05,1))
What sheet name is that formula on?
What is the first cell that contains that formula?
What other cells have you copied/dragged that to?
 
Upvote 0
What sheet name is that formula on?
What is the first cell that contains that formula?
What other cells have you copied/dragged that to?
Hi Peter,

This is a rough example of the actual sheet names I am using, but for simplicity, the formula would exist on a different Sheet name (Like Sheet3). While it did also work for separate sheet names in the formula (Sheet1 and Sheet2), my data existed on the same sheet, just in different rows, but locked to the same column. So, assuming my data was in A2:BX2 and then the matching data was in A3:BX3 (both on Sheet1, then in Sheet3 I am able to enter this formula into A1 of Sheet3 (or any cell really, A2 if I have column names in A1):

=INDEX(IF(MOD(COLUMN(),2)=0,Sheet1!$A2:$BX2,Sheet1!$A3:$BX3),FLOOR(COLUMN()/2+0.05,1))

Then I just drag it to the right and it alternates between the two values (A2, A3, B2, B3, A4, B4, etc)
 
Upvote 0
Hi Peter,

This is a rough example of the actual sheet names I am using, but for simplicity, the formula would exist on a different Sheet name (Like Sheet3). While it did also work for separate sheet names in the formula (Sheet1 and Sheet2), my data existed on the same sheet, just in different rows, but locked to the same column. So, assuming my data was in A2:BX2 and then the matching data was in A3:BX3 (both on Sheet1, then in Sheet3 I am able to enter this formula into A1 of Sheet3 (or any cell really, A2 if I have column names in A1):

=INDEX(IF(MOD(COLUMN(),2)=0,Sheet1!$A2:$BX2,Sheet1!$A3:$BX3),FLOOR(COLUMN()/2+0.05,1))

Then I just drag it to the right and it alternates between the two values (A2, A3, B2, B3, A4, B4, etc)
Sorry, but to add, I was also able to drag this down after dragging it across since the data aligned. Oddball use-case, I know, but it's how the data was in the sheet. Imagine names of something across 75 columns and then specific values across 75 columns that match those names, then the same pattern of names and values multiple rows down. This allowed me to quickly (relatively, still had to figure out how to do the formula) pull together those values side-by-side and then repeat the process for each category containing those names and values.
 
Upvote 0
Hi Peter,

I was excited to share an example file I made for you only to realize I can't upload (I can't install that XL2BB thing on my machine). However, here are the screenshots that should allow you to replicate exactly what I am up to. Sorry for my imperfect Excel syntax explanation, I'm more of a tinkerer, but this should allow you to get functionality with what I did. Sheet 1 is the example collection of data on multiple lines. Sheet 2 (preDrag) has the single formula that can be dragged right and then down, and finally the other Sheet 2 image is the result. Hope this helps!
 

Attachments

  • Sheet1_altPaste.PNG
    Sheet1_altPaste.PNG
    20.6 KB · Views: 19
  • Sheet2_preDrag_altPaste.PNG
    Sheet2_preDrag_altPaste.PNG
    15.4 KB · Views: 18
  • Sheet2_altPaste.PNG
    Sheet2_altPaste.PNG
    13.6 KB · Views: 19
Upvote 0

Forum statistics

Threads
1,215,049
Messages
6,122,864
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top