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

วิธีแปลงสตริงเวลาเป็นเวลาใน Excel

ตัวอย่างเช่นคุณมีรายการสตริงข้อความในแผ่นงานและตอนนี้คุณต้องแปลงสตริงข้อความเหล่านี้เป็นเวลาหรือวันที่และเวลาคุณจะแก้ปัญหาได้อย่างไร ที่นี่ฉันจะแนะนำเทคนิคบางอย่างเพื่อให้คุณแปลงสตริงข้อความเป็นเวลาใน Excel ได้อย่างรวดเร็ว

แปลงสตริงข้อความเป็นเวลา

แปลงสตริงข้อความเป็นวันที่และเวลา


ลูกศรสีฟ้าฟองขวา แปลงสตริงข้อความเป็นเวลา

ในการแปลงสตริงข้อความเป็นเวลาคุณสามารถใช้สูตรบางอย่างเพื่อแก้ปัญหา

1. เลือกเซลล์และพิมพ์สูตรนี้ = TIMEVALUE (LEFT (A1, LEN (A1) -2) & ":" & RIGHT (A1,2)) (A1 คือสตริงข้อความที่คุณต้องแปลงเป็นเวลา) ลงไปแล้วกด เข้าสู่. หากคุณต้องการคุณสามารถลากที่จับเติมไปยังช่วงที่คุณต้องการได้ ดูภาพหน้าจอ:
doc-time-string-to-time-1

2. จากนั้นคลิกขวาที่เซลล์ที่เลือกเหล่านี้และเลือก จัดรูปแบบเซลล์ จากเมนูบริบทจากนั้นในไฟล์ จัดรูปแบบเซลล์ ใหเลือก เวลา จาก หมวดหมู่ รายการภายใต้ จำนวน จากนั้นเลือกประเภทเวลาที่คุณต้องการ
doc-time-string-to-time-2

3 คลิก OKตอนนี้สตริงข้อความถูกแปลงเป็นเวลา
doc-time-string-to-time-3

หมายเหตุ

1. สูตรนี้ไม่สามารถทำงานได้อย่างถูกต้องเมื่อสตริงข้อความรวมวินาทีเช่น 120158

2. หากรูปแบบสตริงข้อความของคุณคือ 120456P คุณสามารถใช้สูตรนี้ได้ =TEXT(--(LEFT(A1,LEN(A1)-1)),"0\:00\:00")+((RIGHT(A1,1)="P")/2)จากนั้นจัดรูปแบบเซลล์เป็นนาฬิกา 12 ชั่วโมงที่คุณต้องการ ดูภาพหน้าจอ:

doc-time-string-to-time-4
doc-time-string-to-time-5

ลูกศรสีฟ้าฟองขวา แปลงสตริงข้อความเป็นวันที่และเวลา

หากสตริงข้อความของคุณมีวันที่และเวลาเช่น 20141212 0312 คุณสามารถใช้สูตรยาวเล็กน้อยเพื่อแก้ปัญหา

1. พิมพ์สูตรนี้ในเซลล์ว่าง =DATE(LEFT(A1,4),MID(A1,5,2),MID(A1,7,2))+TIME(MID(A1,10,2),RIGHT(A1,2),0)จากนั้นกด เข้าสู่ คีย์หากคุณต้องการคุณสามารถใช้สูตรนี้กับช่วงได้

2. จากนั้นคลิกขวาที่เซลล์ที่เลือกและเลือก จัดรูปแบบเซลล์ จากเมนูบริบทจากนั้นในไฟล์ จัดรูปแบบเซลล์ ใหเลือก วันที่ จาก หมวดหมู่ รายการและเลือกประเภทที่คุณต้องการจากส่วนด้านขวา
doc-time-string-to-time-6

3 คลิก OK. ตอนนี้คุณสามารถเห็นสตริงข้อความที่แปลงเป็นวันที่และเวลา
doc-time-string-to-time-7

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

แปลงเวลาเป็นค่าทศนิยมใน Excel ได้อย่างรวดเร็ว

ตัวอย่างเช่นคุณมีรายการเวลาที่ต้องแปลงเป็นชั่วโมงทศนิยมนาทีหรือวินาทีคุณจะแก้ปัญหาใน 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 (19)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Would love any help with this. I have data that is reported as "1d 01h 01m" representing 1 day, 1 hour, 1 min and I need to be able to represent this as a single number (preferably in # of minutes) any thoughts on how I can convert this string to a number value? Thanks all!
This comment was minimized by the moderator on the site
how to convert 06Hr:11Mi into 06:11
This comment was minimized by the moderator on the site
Hi, abinash kumar, you can remove alpha characters from your time string.
This tutorial can help you:
How to remove alpha characters from cells in Excel?
This comment was minimized by the moderator on the site
how do I convert Date/Time with this text format 08/07/2022 1519
This comment was minimized by the moderator on the site
Hi, Tina, please give me a specific example for explaining and descriping your problem. Thank you.
This comment was minimized by the moderator on the site
Hi there!

I used one of formulas above to convert a time string and it worked beautifully expect for anything that had a format of 1200P. It should convert to 12:00 but instead converts to 00:00. Any thoughts on why or how to fix it?

I used: "120456P, you can use this formula =TEXT(--(LEFT(A1,LEN(A1)-1)),"0\:00\:00")+((RIGHT(A1,1)="P")/2)"

I did not have any seconds in my time string so I deleted the last set of 0's in the formula and it still worked.
This comment was minimized by the moderator on the site
Hi.,I have a query.
I want to convert a duration extracted in a format #h #m #s to duration format so that I can filter it. For example:
My data has a field named Session Duration and the format of the cell is "General" and the cell says "1h 2m 15s". I need to convert this data into 01:02:15 but not in time format but a duration. Is there a way to do that.
This comment was minimized by the moderator on the site
=A1/(24*60) (algebra methods)..hahhaha
then apply time format
This comment was minimized by the moderator on the site
How can I convert 1 Hour 35 Min 25 Sec, stored as a text format into Hour format (hh:nn:ss)?
This comment was minimized by the moderator on the site
Hi, Gabriel, you can try this formula =TIME(LEFT(K4,1),MID(K4,8,2),MID(K4,15,2)) K4 is the cell contains text you want to convert, then format the result as time.
This comment was minimized by the moderator on the site
2h 50m how do i convert into 2:50
This comment was minimized by the moderator on the site
Hi, Ayaan, you can try Find and Replace function, h (blank) replace wth : , m replace with nothing
This comment was minimized by the moderator on the site
using the [ =TEXT(--(LEFT(A1,LEN(A1)-1)),"0\:00\:00")+((RIGHT(A1,1)="P")/2) ] formula,
in example #2 above, 123706A >> gets converted to 12:37:06 PM (instead of 12:37:06 AM)
how may this be rectified?
This comment was minimized by the moderator on the site
You only need to change the P to A in the formula =TEXT(--(LEFT(A1,LEN(A1)-1)),"0\:00\:00")+((RIGHT(A1,1)="A")/2), the format the formula cell as hh:mm:ss AM/PM
This comment was minimized by the moderator on the site
so if you enter 35943A you get 3:59:43 AM (which is great).
but if you enter 123706A you would expect to get 12:37:06 AM but instead you get 12:37:06 PM (which is not so great).
also if you enter 123706P you get 12:37:06 AM (again expecting to get 12:37:06 PM).
the meridiem are only incorrect for 12xxxx, formula works flawlessly for 1~11.
any way to improve the formula, to be all encompassing? thank you
This comment was minimized by the moderator on the site
It is a little complex, sorry I cannot help you. Maybe someone in our forum https://www.extendoffice.com/forum.html can help you if you place the question in it.
This comment was minimized by the moderator on the site
using the [ =TEXT(--(LEFT(A1,LEN(A1)-1)),"0\:00\:00")+((RIGHT(A1,1)="P")/2) ] formula,
in example #2 above, 123706A >> gets converted to 12:37:06 PM (instead of 12:37:06 AM)
how may this be rectified?
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations