Extract First 2 Words From Filename

MrMaker

Board Regular
Joined
Jun 7, 2018
Messages
53
Office Version
  1. 365
Platform
  1. Windows
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
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hmmm, well I've moved the worksheet from One Drive to a local drive and now it works.

Any ideas?
 
Upvote 0
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))
 
Upvote 0
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...... ?
 
Upvote 0

Forum statistics

Threads
1,214,960
Messages
6,122,479
Members
449,088
Latest member
Melvetica

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