Extract First 2 Words From Filename

MrMaker

New Member
Joined
Jun 7, 2018
Messages
40
Hi all,

I have the below formula which extracts the first 2 words of a filename, and it's been great for years, however, all of a sudden today it no longer works, can anyone advise or help?

=LEFT(TRIM(MID(@CELL("filename",A2),SEARCH("[",@CELL("filename",A2))+1,SEARCH(".",@CELL("filename",A2))-1-SEARCH("[",@CELL("filename",A2)))),FIND("^",SUBSTITUTE(TRIM(MID(@CELL("filename",A2),SEARCH("[",@CELL("filename",A2))+1,SEARCH(".",@CELL("filename",A2))-1-SEARCH("[",@CELL("filename",A2))))&" "," ","^",2))-1)

Thank you in advance
MM
 

Some videos you may like

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

MrMaker

New Member
Joined
Jun 7, 2018
Messages
40
Hmmm, well I've moved the worksheet from One Drive to a local drive and now it works.

Any ideas?
 

maabadi

Well-known Member
Joined
Oct 22, 2012
Messages
1,604
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Try this:
Excel Formula:
=MID(CELL("filename"),FIND("[",CELL("filename"),1)+1,FIND(CHAR(1),SUBSTITUTE(CELL("filename")," ",CHAR(1),2))-FIND("[",CELL("filename"),1))
 

MrMaker

New Member
Joined
Jun 7, 2018
Messages
40
Thank you, but it appears that the issue lies with One Drive as it works perfectly fine when I place the file on my desktop.

Answers on a postcard...... 😁
 

Watch MrExcel Video

Forum statistics

Threads
1,127,266
Messages
5,623,722
Members
415,985
Latest member
salman101

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
Top