ไปยังเนื้อหาหลัก

วิธีแทรกชื่อไฟล์หรือเส้นทางลงในเซลล์ / ส่วนหัวหรือส่วนท้ายใน Excel

สมมติว่าคุณต้องการแทรกชื่อไฟล์หรือเส้นทางไฟล์ลงในเซลล์ส่วนหัวหรือส่วนท้ายของ Excel คุณจะดำเนินการนี้ได้อย่างไร?

แทรกชื่อไฟล์หรือเส้นทางปัจจุบันในเซลล์ด้วยสูตร

แทรกชื่อไฟล์หรือเส้นทางปัจจุบันในส่วนหัว / ส่วนท้ายด้วยฟังก์ชัน Header & Footer

แทรกชื่อไฟล์หรือเส้นทางปัจจุบันในเซลล์ / ส่วนหัวหรือส่วนท้ายด้วย Kutools for Excel ความคิดที่ดี 3


ลูกศรสีฟ้าฟองขวา แทรกชื่อไฟล์หรือเส้นทางปัจจุบันในเซลล์ด้วยสูตร

ด้วยสูตรต่อไปนี้คุณสามารถแทรกชื่อไฟล์หรือพา ธ หรือชื่อชีตในเซลล์ Speicfied ได้อย่างรวดเร็ว

ชิ้น สูตร ตัวอย่าง
ชื่อไฟล์เท่านั้น = MID (CELL ("filename"), SEARCH ("[", CELL ("filename")) + 1, SEARCH ("]", CELL ("filename")) - SEARCH ("[", CELL ("filename ")) - 1) คุณสมบัติผลิตภัณฑ์. xlsx
Filepath เท่านั้น = LEFT (CELL ("ชื่อไฟล์", A1), FIND ("[", CELL ("filename", A1), 1) -1) C: \ Users \ dt \ Desktop \ New โฟลเดอร์ \
ชื่อแผ่นงานที่ใช้งานอยู่เท่านั้น = RIGHT (CELL ("ชื่อไฟล์"), LEN (CELL ("ชื่อไฟล์")) - FIND ("]", CELL ("filename"), 1)) Sheet7
ชื่อไฟล์ปัจจุบันเส้นทางไฟล์และชื่อแผ่นงานที่ใช้งานอยู่ = CELL ("ชื่อไฟล์") C: \ Users \ dt \ Desktop \ New folder \ [products features.xlsx] Sheet7

หมายเหตุ:

1. คัดลอกสูตรข้างต้นที่คุณต้องการไปยังเซลล์ที่ระบุแล้วคุณจะได้ผลลัพธ์ที่ต้องการ

2. ต้องบันทึกสมุดงาน opend


ลูกศรสีฟ้าฟองขวา แทรกชื่อไฟล์หรือเส้นทางปัจจุบันในส่วนหัว / ส่วนท้ายด้วยฟังก์ชัน Header & Footer

ถ้าคุณต้องการแทรกชื่อไฟล์หรือเส้นทางไฟล์ลงในส่วนหัวหรือส่วนท้ายของ wotksheet คุณสามารถใช้ฟังก์ชัน Header & Footer

1. บน Ribbon ให้คลิก สิ่งที่ใส่เข้าไป > ส่วนหัวและส่วนท้าย.

2. จะมีช่องแก้ไขสามช่องในส่วนหัวหรือส่วนท้ายให้คลิก ซ้าย, ศูนย์ or Ringht ช่องที่คุณต้องการแทรกชื่อไฟล์หรือเส้นทาง จากนั้นภายใต้ ออกแบบ คลิกแท็บ เส้นทางของไฟล์, ชื่อไฟล์ or ชื่อแผ่นงาน ที่คุณต้องแทรก ดูภาพหน้าจอ:

doc-insert-ชื่อไฟล์-path1

จากนั้นคลิกเซลล์ใด ๆ และคุณจะเห็นเส้นทางของไฟล์หรือชื่อหรือชื่อแผ่นงานถูกแทรกลงในส่วนหัวและส่วนท้าย ดูภาพหน้าจอ:

แทรกเส้นทางไฟล์ลงในส่วนหัว
doc-insert-ชื่อไฟล์-path2
ใส่ชื่อไฟล์ลงในส่วนท้าย
doc-insert-ชื่อไฟล์-path3

ลูกศรสีฟ้าฟองขวา แทรกชื่อไฟล์หรือเส้นทางปัจจุบันในเซลล์ / ส่วนหัวหรือส่วนท้ายด้วย Kutools for Excel

Kutools สำหรับ Excel's แทรกข้อมูลสมุดงาน เป็นเครื่องมือ mutifunctional ซึ่งสามารถช่วยคุณแทรกชื่อแผ่นงานชื่อสมุดงานเส้นทางสมุดงานหรือเส้นทางสมุดงานและชื่อลงในเซลล์ Excel ส่วนหัวหรือส่วนท้ายได้อย่างรวดเร็วและสะดวก

Kutools สำหรับ Excel, ที่มีมากกว่า 300 ฟังก์ชั่นที่มีประโยชน์ทำให้งานของคุณง่ายขึ้น 

หลังจากการติดตั้ง Kutools สำหรับ Excel โปรดทำดังนี้ :(ดาวน์โหลด Kutools for Excel ได้ฟรีทันที!)

1. คลิก Kutools พลัส > เครื่องมือสมุดงาน > แทรกข้อมูลสมุดงานดูภาพหน้าจอ:

doc แทรกข้อมูลสมุดงาน 3

2. ใน แทรกข้อมูลสมุดงาน กล่องโต้ตอบเลือกข้อมูลสมุดงานที่คุณต้องการแทรกจากบานหน้าต่างด้านซ้ายจากนั้นเลือกสถานที่ที่คุณต้องการแทรกข้อมูล ดูภาพหน้าจอ:

doc แทรกข้อมูลสมุดงาน 2

3. จากนั้นคลิก OK. หากคุณแทรกข้อมูล wotkbook ลงในเซลล์คุณจะได้ผลลัพธ์ดังนี้:

doc-insert-ชื่อไฟล์-path6

ถ้าคุณแทรกข้อมูลเวิร์กบุ๊กลงในส่วนหัวหรือส่วนท้ายคุณสามารถเลือกตำแหน่งที่คุณต้องการแทรกข้อมูลได้ ซ้าย, ขวา or ศูนย์. และคุณสามารถดูตัวอย่างส่วนหัวหรือส่วนท้ายได้จาก รายละเอียด > เค้าโครงหน้ากระดาษ.

หากต้องการทราบข้อมูลเพิ่มเติมเกี่ยวกับคุณลักษณะนี้โปรดไปที่ แทรกข้อมูลสมุดงาน.

ลูกศรสีฟ้าฟองขวา แทรกข้อมูลสมุดงาน

เคล็ดลับถ้าคุณต้องการแทรกแถวหรือคอลัมน์ว่างหลาย ๆ แถวในทุกๆแถวที่ n โปรดลองใช้ Kutools for Excel's แทรกแถวและคอลัมน์ว่าง ดังที่แสดงในภาพหน้าจอต่อไปนี้ ฟังก์ชั่นเต็มรูปแบบโดยไม่มีข้อ จำกัด ใน 60 วัน โปรดดาวน์โหลดและทดลองใช้ฟรีทันที

แบทช์แทรกแถวหรือคอลัมน์ว่างในช่วงเวลาที่กำหนดในช่วง Excel

หากคุณต้องการแทรกแถวว่างในแถวอื่น ๆ คุณอาจต้องแทรกทีละแถว แต่ไฟล์ แทรกแถวและคอลัมน์ว่าง of Kutools สำหรับ Excel สามารถแก้งานนี้ได้ในไม่กี่วินาที คลิกเพื่อทดลองใช้ฟรี 30 วัน!
doc แทรกคอลัมน์แถวว่าง
Kutools for Excel: มีโปรแกรมเสริม Excel ที่มีประโยชน์มากกว่า 300 รายการให้ทดลองใช้ฟรีโดยไม่มีข้อ จำกัด ใน 30 วัน

สุดยอดเครื่องมือเพิ่มผลผลิตในสำนักงาน

🤖 Kutools AI ผู้ช่วย: ปฏิวัติการวิเคราะห์ข้อมูลโดยยึดตาม: การดำเนินการที่ชาญฉลาด   |  สร้างรหัส  |  สร้างสูตรที่กำหนดเอง  |  วิเคราะห์ข้อมูลและสร้างแผนภูมิ  |  เรียกใช้ฟังก์ชัน Kutools...
คุณสมบัติยอดนิยม: ค้นหา เน้น หรือระบุรายการที่ซ้ำกัน   |  ลบแถวว่าง   |  รวมคอลัมน์หรือเซลล์โดยไม่สูญเสียข้อมูล   |   รอบโดยไม่มีสูตร ...
การค้นหาขั้นสูง: VLookup หลายเกณฑ์    VLookup หลายค่า  |   VLookup ข้ามหลายแผ่น   |   การค้นหาที่ไม่ชัดเจน ....
รายการแบบเลื่อนลงขั้นสูง: สร้างรายการแบบหล่นลงอย่างรวดเร็ว   |  รายการแบบหล่นลงขึ้นอยู่กับ   |  เลือกหลายรายการแบบหล่นลง ....
ผู้จัดการคอลัมน์: เพิ่มจำนวนคอลัมน์เฉพาะ  |  ย้ายคอลัมน์  |  สลับสถานะการมองเห็นของคอลัมน์ที่ซ่อนอยู่  |  เปรียบเทียบช่วงและคอลัมน์ ...
คุณสมบัติเด่น: กริดโฟกัส   |  มุมมองการออกแบบ   |   บาร์สูตรใหญ่    สมุดงานและตัวจัดการชีต   |  ห้องสมุดทรัพยากร (ข้อความอัตโนมัติ)   |  เลือกวันที่   |  รวมแผ่นงาน   |  เข้ารหัส/ถอดรหัสเซลล์    ส่งอีเมลตามรายการ   |  ซุปเปอร์ฟิลเตอร์   |   ตัวกรองพิเศษ (กรองตัวหนา/ตัวเอียง/ขีดทับ...) ...
ชุดเครื่องมือ 15 อันดับแรก12 ข้อความ เครื่องมือ (เพิ่มข้อความ, ลบอักขระ, ... )   |   50 + แผนภูมิ ประเภท (แผนภูมิ Gantt, ... )   |   40+ ใช้งานได้จริง สูตร (คำนวณอายุตามวันเกิด, ... )   |   19 การแทรก เครื่องมือ (ใส่ QR Code, แทรกรูปภาพจากเส้นทาง, ... )   |   12 การแปลง เครื่องมือ (ตัวเลขเป็นคำ, การแปลงสกุลเงิน, ... )   |   7 ผสานและแยก เครื่องมือ (แถวรวมขั้นสูง, แยกเซลล์, ... )   |   ... และอื่น ๆ

เพิ่มพูนทักษะ Excel ของคุณด้วย Kutools สำหรับ Excel และสัมผัสประสิทธิภาพอย่างที่ไม่เคยมีมาก่อน Kutools สำหรับ Excel เสนอคุณสมบัติขั้นสูงมากกว่า 300 รายการเพื่อเพิ่มประสิทธิภาพและประหยัดเวลา  คลิกที่นี่เพื่อรับคุณสมบัติที่คุณต้องการมากที่สุด...

รายละเอียด


แท็บ Office นำอินเทอร์เฟซแบบแท็บมาที่ Office และทำให้งานของคุณง่ายขึ้นมาก

  • เปิดใช้งานการแก้ไขและอ่านแบบแท็บใน Word, Excel, PowerPoint, ผู้จัดพิมพ์, Access, Visio และโครงการ
  • เปิดและสร้างเอกสารหลายรายการในแท็บใหม่ของหน้าต่างเดียวกันแทนที่จะเป็นในหน้าต่างใหม่
  • เพิ่มประสิทธิภาพการทำงานของคุณ 50% และลดการคลิกเมาส์หลายร้อยครั้งให้คุณทุกวัน!
Comments (15)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
What's the function to display and file path and file name WITHOUT the active sheet name? Example: C:\Users\dt\Desktop\New folder\products features.xlsx
This comment was minimized by the moderator on the site
Hello, Lydeth Chea
To only display the file path and name without the sheet name, please apply the below formua:
=SUBSTITUTE(LEFT(CELL("filename"), FIND("]", CELL("filename"))-1), "[", "")


Please have a try, thank you!
This comment was minimized by the moderator on the site
Is there an automated way to pass the current Excel filename (no file path, no extension) to the current worksheet name?
This comment was minimized by the moderator on the site
Is it possible to turn a file path in an excel print title into a clickable hyperlink? I would like to publish the excel file as a pdf with a clickable hyperlink in the footer.
This comment was minimized by the moderator on the site
Hi I have about 90 workbooks, and in each workbook i have 5 sheets, i want to put in a new column in every sheet across these workbooks to input the year.
This comment was minimized by the moderator on the site
Hi, correct formula for filename without path is: =MID((CELL("filename"));((SEARCH("[";(CELL("filename"))))+1);((SEARCH("]";(CELL("filename"))))-((SEARCH("[";(CELL("filename"))))+1))) (semicolon in MID and SEARCH funtions, and -1 --> +1 at the end) bye
This comment was minimized by the moderator on the site
For filename without extension: =MID(CELL("filename"),SEARCH("[",CELL("filename"))+1,SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-5)
This comment was minimized by the moderator on the site
This gives an error.
This comment was minimized by the moderator on the site
shouldn't be 6?
This comment was minimized by the moderator on the site
-6 was the correct for me on MS Office 2016 :)
This comment was minimized by the moderator on the site
On mine it works well. However, it finishes with a "." at the end. If you put 6 instead it will return without the ".". It basically works counting the characters which "+1" in the formula is the first character and the "-5" is the amount of characters that are not showing counting from the front. So, if you want to catch only the middle characters eg. (XXXXX from a document named ZZ-YY-WW-XXXXX from a extension .xlsm) you can input as per below:

=MID(CELL("filename"),SEARCH("[",CELL("filename"))+10,SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-15)
This comment was minimized by the moderator on the site
when i am using this function in excel 1 (this is the filename) , and then i open excel 2, the cell in excel 1 changes from "excel 1" to "excel 2". Please advise, how to prevent this.
This comment was minimized by the moderator on the site
Yes, I am having the same problem, this formula seems to point to a variable that is not tied to the actual spreadsheet of the cell the formula exists in but instead to the currently selected spreadsheet or similar.
This comment was minimized by the moderator on the site
I have the same problem when opening a different excel document. Is there a way to leave the file name with the current file?
This comment was minimized by the moderator on the site
You prolly already found this solution. But I figured I'd add it for any future searchers. :-) Simply add the third option, the "A1" reference, to each of the CELL functions as follows: =CELL("filename",A1) =SUBSTITUTE( LEFT(CELL("filename",A1),FIND("]",CELL("filename",A1))-1),"[","") =MID(CELL("filename",A1),SEARCH("[",CELL("filename",A1))+1, SEARCH("]",CELL("filename",A1))-SEARCH("[",CELL("filename",A1))-1)
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations