В Пекине открылся Государственный комитет КНР по контролю
To get the Excel file path or name, you can use the CELL function to implement it indirectly. 1. Use =CELL("filename") to obtain complete information containing paths, file names and worksheets; 2. Use LEFT and FIND functions to extract only paths, the formula is =LEFT(CELL("filename"), FIND("[", CELL("filename")) - 1); 3. Use MID and FIND to extract file names, the formula is =MID(CELL("filename"), FIND("[", CELL("filename")) 1, FIND("]", CELL("filename")) - FIND("[", CELL("filename")) - 1). Note: These formulas are only valid when the file is saved. Unsaved files may return empty values ??or error results, and the formula needs to be nested with other functions to accurately extract the required information.
If you want to get a file path in Excel using a formula—like the full path of the current workbook or worksheet—you won't find a built-in function that does this directly. But there are a few workarounds and formulas that can help pull this information indirectly.

Here's how you can do it:

Use CELL Function to Get File Path
The CELL
function in Excel can retrieve some information about cell formatting, location, or contents. One of its options lets you get the file path when combined with other functions.
Formula:

=CELL("filename")
This returns the full path, including the workbook name and sheet name, like:
C:\FolderName\[WorkbookName.xlsx]Sheet1
If you only want the file path (without the sheet name), combine it with LEFT
, FIND
, and CELL
:
=LEFT(CELL("filename"), FIND("[", CELL("filename")) - 1)
Note: This formula works only when the workbook has been saved at least once. If it's a new, unsaved file, it will return an empty string or incorrect result.
Extract Just the Workbook Name
Sometimes you just need the workbook name without the full path or sheet name. You can extract it by combining MID
, FIND
, and CELL
again:
Formula:
=MID(CELL("filename"), FIND("[", CELL("filename")) 1, FIND("]", CELL("filename")) - FIND("[", CELL("filename")) - 1)
This gives you something like:
WorkbookName.xlsx
Useful if you're building dynamic references or creating reports that include the file name.
Limitations and Tips
- ? Workbook Must Be Saved : As mentioned earlier, these formulas only work properly on saved files. Otherwise, they might return unexpected results or blanks.
- ? Combine with Other Functions : These formulas often need to be nested inside others (
LEFT
,RIGHT
,MID
, etc.) to extract exactly what you need. - ? Named Range Option : You can create a named range using the
CELL("filename")
function so it's easier to reference elsewhere in your workbook. - ? Not Dynamic in All Contexts : While these formulas update when the file is moved or renamed, they don't automatically refresh unless the sheet reccalculates.
So yes, while Excel doesn't have a dedicated "get file path" function, you can use the CELL
function creatively to extract the path, file name, or both. It's not perfect, but it gets the job done in most practical situations.
Basically that's it.
The above is the detailed content of how to get the file path in excel using a formula. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

MicrosoftTeams’freeversionlimitsmeetingsto60minutes.1.Thisappliestomeetingswithexternalparticipantsorwithinanorganization.2.Thelimitdoesnotaffectinternalmeetingswhereallusersareunderthesameorganization.3.Workaroundsincludeendingandrestartingthemeetin

Grouping by month in Excel Pivot Table requires you to make sure that the date is formatted correctly, then insert the Pivot Table and add the date field, and finally right-click the group to select "Month" aggregation. If you encounter problems, check whether it is a standard date format and the data range are reasonable, and adjust the number format to correctly display the month.

Quick Links Check the File's AutoSave Status

To set up the repeating headers per page when Excel prints, use the "Top Title Row" feature. Specific steps: 1. Open the Excel file and click the "Page Layout" tab; 2. Click the "Print Title" button; 3. Select "Top Title Line" in the pop-up window and select the line to be repeated (such as line 1); 4. Click "OK" to complete the settings. Notes include: only visible effects when printing preview or actual printing, avoid selecting too many title lines to affect the display of the text, different worksheets need to be set separately, ExcelOnline does not support this function, requires local version, Mac version operation is similar, but the interface is slightly different.

The tutorial shows how to toggle light and dark mode in different Outlook applications, and how to keep a white reading pane in black theme. If you frequently work with your email late at night, Outlook dark mode can reduce eye strain and

It's common to want to take a screenshot on a PC. If you're not using a third-party tool, you can do it manually. The most obvious way is to Hit the Prt Sc button/or Print Scrn button (print screen key), which will grab the entire PC screen. You do

MicrosoftTeamsrecordingsarestoredinthecloud,typicallyinOneDriveorSharePoint.1.Recordingsusuallysavetotheinitiator’sOneDriveina“Recordings”folderunder“Content.”2.Forlargermeetingsorwebinars,filesmaygototheorganizer’sOneDriveoraSharePointsitelinkedtoaT

Finding the second largest value in Excel can be implemented by LARGE function. The formula is =LARGE(range,2), where range is the data area; if the maximum value appears repeatedly and all maximum values ??need to be excluded and the second maximum value is found, you can use the array formula =MAX(IF(rangeMAX(range),range)), and the old version of Excel needs to be executed by Ctrl Shift Enter; for users who are not familiar with formulas, you can also manually search by sorting the data in descending order and viewing the second cell, but this method will change the order of the original data. It is recommended to copy the data first and then operate.
