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

วิธีแปลงหมายเลขสัปดาห์เป็นวันที่หรือในทางกลับกันใน Excel

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

แปลงหมายเลขสัปดาห์เป็นวันที่ด้วยสูตร

แปลงวันที่เป็นเลขสัปดาห์ด้วยสูตร


แปลงหมายเลขสัปดาห์เป็นวันที่ด้วยสูตร

สมมติว่าฉันมีหมายเลขปีและสัปดาห์แบบสุ่มซึ่งเป็นปี 2015 และ 15 ในแผ่นงานตามภาพหน้าจอต่อไปนี้ที่แสดงและตอนนี้ฉันต้องการหาวันที่เฉพาะจากวันจันทร์ถึงวันอาทิตย์ตามหมายเลขสัปดาห์ที่กำหนดนี้

ในการคำนวณช่วงวันที่ตามจำนวนสัปดาห์ที่ระบุคุณสามารถใช้สูตรต่อไปนี้:

1. เลือกเซลล์ว่างคุณจะส่งคืนวันที่เริ่มต้น (ในกรณีของเราเราเลือกเซลล์ B5) ป้อนสูตร: =MAX(DATE(B1,1,1),DATE(B1,1,1)-WEEKDAY(DATE(B1,1,1),2)+(B2-1)*7+1)และกดปุ. ม เข้าสู่ สำคัญ. ดูภาพหน้าจอด้านล่าง:

2. เลือกเซลล์ว่างอื่นคุณจะส่งคืนวันที่สิ้นสุด (ในกรณีของเราเราเลือกเซลล์ B6) ให้ป้อน =MIN(DATE(B1+1,1,0),DATE(B1,1,1)-WEEKDAY(DATE(B1,1,1),2)+B2*7)และกดปุ. ม เข้าสู่ สำคัญ. ดูภาพหน้าจอด้านล่าง:

หมายเหตุริบบิ้น สูตรซับซ้อนเกินไปที่จะจำ? บันทึกสูตรเป็นรายการข้อความอัตโนมัติเพื่อใช้ซ้ำได้ในคลิกเดียวในอนาคต!
อ่านเพิ่มเติม ...     ทดลองใช้ฟรี

หมายเหตุ: ในทั้งสองสูตรด้านบน B1 ประกอบด้วยปีและ B2 เป็นหมายเลขสัปดาห์ที่ระบุคุณสามารถเปลี่ยนอาร์กิวเมนต์ได้ตามต้องการ)

3. อย่างที่คุณเห็นทั้งสองสูตรจะส่งกลับตัวเลขแทนวันที่ เลือกทั้งผลการคำนวณต่อไปและคลิก หน้าแรก > รูปแบบตัวเลข กล่อง> วันที่สั้น เพื่อเปลี่ยนตัวเลขเป็นวันที่ ดูภาพหน้าจอด้านล่าง:

คลิกเดียวเพื่อแปลงวันที่ / ตัวเลข / ข้อความในการจัดรูปแบบที่ไม่เป็นมาตรฐานหลายรายการเป็นวันที่ปกติใน Excel

Kutools สำหรับ Excel's แปลงเป็นวันที่ ยูทิลิตี้สามารถช่วยให้คุณระบุและแปลงวันที่หรือตัวเลขที่ไม่เป็นมาตรฐาน (yyyymmdd) หรือข้อความเป็นวันที่ปกติได้อย่างง่ายดายด้วยการคลิกเพียงครั้งเดียวใน Excel


โฆษณาแปลงเป็นวันที่ 1

แปลงวันที่เป็นเลขสัปดาห์ด้วยสูตร

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

1. เลือกเซลล์ว่างคุณจะส่งคืนหมายเลขสัปดาห์ป้อนสูตรนี้: = WEEKNUM (B1,1)แล้วกดปุ่ม Enter ดูภาพหน้าจอ:

หมายเหตุ:

(1) ในสูตรข้างต้น B1 มีวันที่ที่คุณต้องการใช้

(2) หากคุณต้องการส่งคืนหมายเลขสัปดาห์จากวันที่ซึ่งเริ่มต้นในวันจันทร์โปรดใช้สูตรนี้: = WEEKNUM (B1,2).


บทความที่เกี่ยวข้อง:

วิธีการนับจำนวนวันธรรมดาระหว่างสองวันใน Excel

จะเพิ่ม / ลบวัน / เดือน / ปีใน Excel ได้อย่างไร?

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

🤖 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 (24)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
so much complicated.

just hit this one

=TEXT(A2 - (WEEKDAY(A2,2)) + 1, "MMM DD") & " - " & TEXT(A2 + 7 - (WEEKDAY(A2,2)), "MMM DD")
This comment was minimized by the moderator on the site
All of these formulas have issues when the date is in the last week of the year. They don't give the correct date for Monday of the last week.
This comment was minimized by the moderator on the site
I find this better "Start of week"
B5=(8-WEEKDAY(DATE(B1,1,1),1))+((B2-2)*7)+DATE(B1,1,1)

8-WEEKDAY(DATE(B1,1,1),1) => find the no. of days in a week for first week of the year
(B2-2)*7 => calculate the number of days excluding the first week of year and the week for which calculation is being done
Then add these 2 to the first day of the year to get first day of the desired week


Then "End of week",
B6=B5+6

PS:
Week starts on Sunday
For weeks starting on Monday, use this instead:
B5=(8-WEEKDAY(DATE(B1,1,1),2))+((B2-2)*7)+DATE(B1,1,1)
This comment was minimized by the moderator on the site
Your formula works perfectly for every year. End of week would be B6=B5+6 though. Thanks a lot!
This comment was minimized by the moderator on the site
Thanks. Will correct that...
This comment was minimized by the moderator on the site
This formula is overly complicated. If you have a date say 8/17/2021 in Cell A1, to get the Week Ending(as of Saturday) you just need the following: = A1-WEEKDAY(A1,1)+7This will return 8/21/2021. Date of 12/30/2020 will return 1/2/2021 as week ending.
This comment was minimized by the moderator on the site
Hi,

not sure if this has been asked, but essentially, I want to be able to drag the date and the week number automatically fill beside it when I do that.

Can anyone help?

This comment was minimized by the moderator on the site
@gilly2801 you can use an array formula for example with "=weeknum(C2:C)" press command shift enter and it will turn it into an array function.
This comment was minimized by the moderator on the site
Hi please help me.

Suppose we are considering Date 1 to 7 is week 1 and 8 to 14 is week 2. Can you please help me out how can i use if function to calculate week. I have tried but not able to get the correct result.
This comment was minimized by the moderator on the site
=ROUNDUP((TODAY()-DATE(YEAR(TODAY()),1,1))/7,0)
This comment was minimized by the moderator on the site
=ROUNDUP((TODAY()-DATE(YEAR(TODAY()),1,1))/7,0)
This comment was minimized by the moderator on the site
Thank YOU!!!!
This comment was minimized by the moderator on the site
Thank you very much!


=CONCATENATE("Inclusive Dates: ",TEXT(MAX(DATE(TEXT(TODAY(),"yyyy"),1,1),DATE(TEXT(TODAY(),"yyyy"),1,1)-WEEKDAY(DATE(TEXT(TODAY(),"yyyy"),1,1),2)+(WEEKNUM(TODAY())-1)*7+1),"MMMM")," ",TEXT(MAX(DATE(TEXT(TODAY(),"yyyy"),1,1),DATE(TEXT(TODAY(),"yyyy"),1,1)-WEEKDAY(DATE(TEXT(TODAY(),"yyyy"),1,1),2)+(WEEKNUM(TODAY())-1)*7+1),"DD"),", ",TEXT(MAX(DATE(TEXT(TODAY(),"yyyy"),1,1),DATE(TEXT(TODAY(),"yyyy"),1,1)-WEEKDAY(DATE(TEXT(TODAY(),"yyyy"),1,1),2)+(WEEKNUM(TODAY())-1)*7+1),"YYYY")," - ",TEXT(MIN(DATE(TEXT(TODAY(),"yyyy")+1,1,0),DATE(TEXT(TODAY(),"yyyy"),1,1)-WEEKDAY(DATE(TEXT(TODAY(),"yyyy"),1,1),2)+WEEKNUM(TODAY())*7),"MMMM")," ",TEXT(MIN(DATE(TEXT(TODAY(),"yyyy")+1,1,0),DATE(TEXT(TODAY(),"yyyy"),1,1)-WEEKDAY(DATE(TEXT(TODAY(),"yyyy"),1,1),2)+WEEKNUM(TODAY())*7),"DD"),", ",TEXT(MIN(DATE(TEXT(TODAY(),"yyyy")+1,1,0),DATE(TEXT(TODAY(),"yyyy"),1,1)-WEEKDAY(DATE(TEXT(TODAY(),"yyyy"),1,1),2)+WEEKNUM(TODAY())*7),"YYYY"))
This comment was minimized by the moderator on the site
Date(2017;1;7 * weeknumer - 5) 5 monday, 4 tuesday... :)
This comment was minimized by the moderator on the site
Or to make in not specific to the year 2017...
=DATE(YEAR,1,7 * WEEKNUM - WEEKDAY(DATE(YEAR,1,7) - 2))

2 monday, 3 tuesday,...
This comment was minimized by the moderator on the site
I'm sorry folks, but I could neither understand nor make work any of the formulas above so I finally figured out the following solution: DATE(B1,1,1)+($A4×7)−(6−(7−WEEKDAY(DATE(B1,1,1),first-day))) The first part "DATE(B1,1,1)+(B2×7)" simply takes January 1 of the year and adds the number of weeks. The next part calculates how many days to subtract from the WEEKDAY of January 1 to get the first day of the week. This is what I finally figured out: 6−(7−WEEKDAY(DATE(B1,1,1),first-day)) If, for example, January 1 falls on a Sunday (day 7), then this formula become "6-(7-7)" or simply 6 - which is the number of days you need to subtract to get Monday of that week. Try other days. Finally, if you want to find any other day of the week, just add the WEEKDAY number minus 1 to this result. So the last day of the week (Sunday) is: DATE(B1,1,1)+($A4×7)−(6−(7−WEEKDAY(DATE(B1,1,1),first-day)))+(7−1) Which can be simplified to: DATE(B1,1,1)+($A4×7)−(12−(7−WEEKDAY(DATE(B1,1,1),first-day))) Wednesday would be: DATE(B1,1,1)+($A4×7)−(8−(7−WEEKDAY(DATE(B1,1,1),first-day))) etc. I hope this helps someone else who needs this both with a workable solution along with a bit of understanding of how it was arrived at!
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