Trying to mass copy a formula with varying cell references

wesleyterrill

New Member
Joined
Feb 9, 2016
Messages
15
Kind of confusing title, sorry about that! Let me elaborate...

I have the following formula in a cell:

=LEFT(INDIRECT("Source!A2"),FIND(" ",INDIRECT("Source!A2"),1)-1) *(Don't worry about what the formula actually does.)*

Basically, I'm trying to drag this cell down about 1000 times for bulk data purposes. BUT... the cell(s) being referenced increase by 3 every time. So, for the next line, it should be A5, then A8, then A11, and so on.

The next 2 formulae should be as follows:

=LEFT(INDIRECT("Source!A5"),FIND(" ",INDIRECT("Source!A5"),1)-1)
=LEFT(INDIRECT("Source!A8"),FIND(" ",INDIRECT("Source!A8"),1)-1)

Whenever I select the first cell (or even the first several cells) and drag down... It only copies the formula(e), it does not update. Does anybody have an idea of how to drag this info down and have it reflect the proper cell? I have finished about 50 lines manually, but I feel like there's a much more efficient way. Thanks for the help!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Welcome to the Forum!

On the face of it, you could use:

=LEFT(INDIRECT("Source!A"&2+3*(ROW()-ROW($n:$n))),FIND(" ",INDIRECT("Source!A"&2+3*(ROW()-ROW($n:$n))),1)-1)

where n is the row number of the first cell with this formula.

*(Don't worry about what the formula actually does.)*

But I am curious why you're using INDIRECT, and whether the formula will work if you truncate the reference in this way?
 
Upvote 0
You need to convert the row reference in the quotes (eg "Source!A5") to a formula rather than a constant. One way is to note what row your formula is starting on and use that. For example if your first formula was in row 2, instead of:
Code:
=LEFT(INDIRECT("Source!A5"),FIND(" ",INDIRECT("Source!A5"),1)-1)

try
Code:
=LEFT(INDIRECT("Source!A"&5+3*(row()-2)),FIND(" ",INDIRECT("Source!A"&5+3*(row()-2)),),1)-1)

So the key there is the 5+3*(row()-2). On row 2 that evaluates to 5+0=5. On row 3 it evaluates to 5+3*(1) = 8, 11,14,17, etc.
If you are starting on a different row you can just change the -2 reference to the start row number.

HTH
 
Upvote 0
Thanks for the response, Stephen. Haha, it's funny you ask, I was looking at the formula with a coworker and even he was like ".....why are you using INDIRECT?" Basically, in cell A2 I have the full name of someone. I am wanting to have the first name in one cell and the last name in another. I did some research and that was a formula I found. It worked initially so I didn't question it. I will try your suggestion and see if it works. Thanks again!
 
Upvote 0
Try this.

=LEFT(INDEX(Source!A:A,2+3*(ROW()-2)),FIND(" ",INDEX(Source!A:A,2+3*(ROW()-2)))-1)
 
Upvote 0
Thanks for the response, Stephen. Haha, it's funny you ask, I was looking at the formula with a coworker and even he was like ".....why are you using INDIRECT?" Basically, in cell A2 I have the full name of someone. I am wanting to have the first name in one cell and the last name in another. I did some research and that was a formula I found. It worked initially so I didn't question it. I will try your suggestion and see if it works. Thanks again!

Just use Norie's formula. You don't need INDIRECT.
 
Upvote 0
Thanks again for your help, guys! I am using the formula that StephenCrump shared but I need to adjust it slightly. This is what my 1st sheet (where I import my data) looks like:

NameLocationCurrent Title & CompanyProject
John MahanDallasSales managerSales
Amazon
Mary ThompsonAustinSales EngineerSales
Shell
Jacob SmithHousonDirector of SalesSales
BP

<tbody>
</tbody>


Basically, this is what my data looks like when I import it to Excel. I need to sort that data into First Name, Last Name, Company, and Job Title. That's where my original formula comes in. The formula for "First Name" did exactly what I needed it to.... But when I inserted that formula into the respective cell, it pulled Mary's name instead of John's, does that make sense? My 2nd sheet (where I need the formulae) looks like this:

First NameLast NameJob TitleCompany
=LEFT(INDIRECT("Source!A"&2+3*(ROW()-ROW($N:$N))),FIND(" ",INDIRECT("Source!A"&2+3*(ROW()-ROW($N:$N))),1)-1)=TRIM(RIGHT(SUBSTITUTE(INDIRECT("Source!A2")," ",REPT(" ",LEN(INDIRECT("Source!A2")))),LEN(INDIRECT("Source!A2"))))=INDIRECT("Source!C2")=INDIRECT("Source!C3")

<tbody>
</tbody>


I am more than willing to drop the INDIRECT aspect of the formula, I'm not even sure what it does. I had someone suggest it at some point and it appeared to work so I kept it. I'll need to adjust the formula to match where it is on the sheet (I'm sure that's an easy fix, I just don't know where to look.) And I'd like to be able to drag all 4 cells down about 1000 times. Thanks again for all of your help, let me know if you need anything additional from me!
 
Upvote 0
There are different ways you could rearrange this data set, e.g. some might prefer a VBA solution.

Using your formula approach, and starting with Norie's formula (no need for INDIRECT) for the first column:

A2: =LEFT(INDEX(Source!A:A,2+3*(ROW()-2)),FIND(" ",INDEX(Source!A:A,2+3*(ROW()-2)))-1)
B2: =MID(INDEX(Source!A:A,2+3*(ROW()-2)),LEN(A2)+2,99) (You could TRIM to allow for multiple separating spaces)
C2: =INDEX(Source!B:B,2+3*(ROW()-2))
D2: =INDEX(Source!C:C,2+3*(ROW()-2))
E2: =INDEX(Source!C:C,3+3*(ROW()-2))
F2: =INDEX(Source!D:D,2+3*(ROW()-2))

In my case, I have started all these formulae in Row 2. If you start in another row, adjust all the ROW()-2 references accordingly.

These 2's and 3's:
2+3*(ROW()-2)
3+3*(ROW()-2)

assume the source data (i.e. the John Mahan line) is in row 2, and also should be adjusted if that's not the case.

Excel 2010
ABCDEF
1NameLocationTitleCompanyProject
2John MahanDallasSales managerAmazonSales
3Mary ThompsonAustinSales EngineerShellSales
4Jacob SmithHousonDirector of SalesBPSales

<tbody>
</tbody>
Results

Excel 2010
ABCD
1NameLocationCurrent Title & CompanyProject
2John MahanDallasSales managerSales
3Amazon
4
5Mary ThompsonAustinSales EngineerSales
6Shell
7
8Jacob SmithHousonDirector of SalesSales
9BP

<tbody>
</tbody>
Source
 
Upvote 0
Perfect, this is exactly what I was looking for. Thank you StephenCrump and Norie for your help! I'll try to stay away from VBA for now... it's a bit above my "expertise" haha!
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,893
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