Amend Formula to extract year from Cell

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,561
Office Version
  1. 2021
Platform
  1. Windows
I have the following formula below


Code:
 =INDEX('C:\My Documents\[Comms2019.xlsm]Comms by month'!$A$11:$N$11,MATCH('C:\My Documents\[Comms2019.xlsm]Comms by month'!B1,'C:\My Documents\[Comms2019.xlsm]Comms by month'!$A$1:$M$1))

I would like to amend the formula to extract the year from cell P1 so when the year in P1 changes the formula containing the year chnges automatically



I have the year in cell P1 and have tried to amend formula

Code:
=INDEX('C:\My Documents\[Comms2019.xlsm] to extract this from P1 eg  =INDEX('C:\My Documents\[Comms"&P1&".xlsm]


It would be appreciated if someone could assist me
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Try (untested)

=INDEX(INDIRECT("'C:\My Documents\[Comms" & P1 & ".xlsm]Comms by month'!$A$11:$N$11"),MATCH(INDIRECT("'C:\My Documents\[Comms" & P1 & ".xlsm]Comms by month'!B1"),INDIRECT("'C:\My Documents\[Comms"& P1 & ".xlsm]Comms by month'!$A$1:$M$1")))
 
Upvote 0
I would like to know how amend formula so that B1 become C1, D1 etc when copied across

Comms by month'!B1"),
 
Upvote 0
Starting to get complicated...!
Untested again

=INDEX(INDIRECT("'C:\My Documents\[Comms" & P1 & ".xlsm]Comms by month'!$A$11:$N$11"),MATCH(INDEX(INDIRECT("'C:\My Documents\[Comms" & P1 & ".xlsm]Comms by month'!B1:ZZ1",1,COLUMNS($A1:A1)),INDIRECT("'C:\My Documents\[Comms"& P1 & ".xlsm]Comms by month'!$A$1:$M$1")))
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,167
Members
448,554
Latest member
Gleisner2

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