Conditionally Extending the Reference of a String

apor

New Member
Joined
Dec 20, 2021
Messages
25
Office Version
  1. 2016
Platform
  1. Windows
Hello everyone,

I am currently working with a sheet that extracts data from a pdf that i upload using queries & connections.

the string looks like this in cell B2
B2=IF(LEN(INDIRECT("Page002!C12"))=11,INDIRECT("Page002!C12"), IF(LEN(INDIRECT("Page002!D12"))=11,INDIRECT("Page002!D12"), IF(LEN(INDIRECT("Page002!E12"))=11,INDIRECT("Page002!E12"),"") ) )
B3=IF(LEN(INDIRECT("Page002!C22"))=11,INDIRECT("Page002!C22"), IF(LEN(INDIRECT("Page002!D22"))=11,INDIRECT("Page002!D22"), IF(LEN(INDIRECT("Page002!E22"))=11,INDIRECT("Page002!E22"),"") ) )
B4=IF(LEN(INDIRECT("Page002!C32"))=11,INDIRECT("Page002!C32"), IF(LEN(INDIRECT("Page002!D32"))=11,INDIRECT("Page002!D32"), IF(LEN(INDIRECT("Page002!E32"))=11,INDIRECT("Page002!E32"),"") ) )
B5=IF(LEN(INDIRECT("Page002!C42"))=11,INDIRECT("Page002!C42"), IF(LEN(INDIRECT("Page002!D42"))=11,INDIRECT("Page002!D42"), IF(LEN(INDIRECT("Page002!E42"))=11,INDIRECT("Page002!E42"),"") ) )
it is somewhat laborios and takes the data from either cell c12/22/32/42, cell d12/22/32/42 or cell e12/22/32/42 from the sheet with the name Page002 if the length of the cell is 11.

then, starting at B6 to B9, it starts over, only with the sheet called Page003
B6==IF(LEN(INDIRECT("Page003!C12"))=11,INDIRECT("Page003!C12"), IF(LEN(INDIRECT("Page003!D12"))=11,INDIRECT("Page003!D12"), IF(LEN(INDIRECT("Page003!E12"))=11,INDIRECT("Page003!E12"),"") ) )
an so on....

i have to extende the string up until Page100, hwoever, i have been doing this by hand and it takes hours. i need to copy the strings of B2-B5 and paste them, and then change the Sheet Reference by hand.

Is there a way to possibly shorten the string or automatically extend it down?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
This sounds doable -- propagating the formulas -- but I cannot tell without more. Might you post a workbook with fake but realistic data? Do using the link icon above the message area. Put file on Dropbox, 1Drive, Google Drive etc.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

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