Formula to change part of the information in each column according to the respective row?

michikorc

New Member
Joined
Oct 6, 2017
Messages
2
Hi Excel Experts,

I am a newbie to this forum (and much of Excel's functions). I am wondering if it is in any way possible for me to come up with a formula for the following problem:

I have 3 columns, for e.g.:

SubjectID Full path to Pic1 Full path to Pic2
0001 /Users/Desktop/0001/animals/pig.jpg /Users/Desktop/0001/cow.jpg
0002
.
.
.

I would like to come up with a formula that automatically changes part of the path address, specifically to reflect the subject ID. For example, instead of manually copying/typing out /Users/Desktop/0002/animals/pig.jpg and /Users/Desktop/0002/animals/cow.jpg for Subject 0002, the formula would change '0001' to '0002' within the path address and this can be done for every column according to the ID in the respective row.

I am not sure if this can be done in Excel.. but it would be nearly impossible for me to manually do this as I have over 1000 folders/subjects!

This file will be saved as a tab delimited text file to be entered into a script subsequently.

Thanks very much in advance!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Welcome to the MrExcel board!

Is this what you mean? Formula in B3 is copied across and down.
If not please explain again with reference to specific before and after samples.


Book1
ABC
20001/Users/Desktop/0001/animals/pig.jpg/Users/Desktop/0001/cow.jpg
30002/Users/Desktop/0002/animals/pig.jpg/Users/Desktop/0002/cow.jpg
40003/Users/Desktop/0003/animals/pig.jpg/Users/Desktop/0003/cow.jpg
Sheet2 (2)
Cell Formulas
RangeFormula
B3=SUBSTITUTE(B2,"/"&$A2&"/","/"&$A3&"/")
 
Upvote 0
Welcome to the MrExcel board!

Is this what you mean? Formula in B3 is copied across and down.
If not please explain again with reference to specific before and after samples.

ABC
20001/Users/Desktop/0001/animals/pig.jpg/Users/Desktop/0001/cow.jpg
30002/Users/Desktop/0002/animals/pig.jpg/Users/Desktop/0002/cow.jpg
40003/Users/Desktop/0003/animals/pig.jpg/Users/Desktop/0003/cow.jpg

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet2 (2)

Worksheet Formulas
CellFormula
B3=SUBSTITUTE(B2,"/"&$A2&"/","/"&$A3&"/")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Hi Peter, thanks for the quick response. I think that's right, but is there any way for it to be an almost-automated process where I could simply copy and paste the formula across the cells instead of changing the formula in each cell to match the output required?
i.e. For the formula you kindly provided, it would still be necessary to go in and change for example, B2,A2,A3 variables.

Thank you!
 
Upvote 0
Perhaps I have not understood your requirement.

i.e. For the formula you kindly provided, it would still be necessary to go in and change for example, B2,A2,A3 variables.
What would you be changing them to?

Could you give a small set of sample data (say 5-6 rows) showing both what it looks like 'before' anything is done and what it would look like 'after' whatever has to be done?
 
Upvote 0

Forum statistics

Threads
1,215,882
Messages
6,127,530
Members
449,385
Latest member
KMGLarson

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