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

วิธีการปัดเศษวันที่เป็นวันธรรมดาก่อนหน้าหรือถัดไปใน Excel

doc-รอบไปก่อนหน้าอาทิตย์-1
บางครั้ง คุณอาจต้องรับวันทำงานที่ระบุก่อนหน้าหรือถัดไป เช่น วันอาทิตย์ โดยยึดตามวันที่ที่แสดงภาพหน้าจอด้านซ้าย บทช่วยสอนนี้มีสูตรสองสูตรสำหรับจัดการงานนี้อย่างง่ายดายใน Excel
รอบวันที่เป็นวันธรรมดาถัดไป
วันที่ปัดเศษเป็นวันทำงานที่ระบุก่อนหน้า

ลูกศรสีฟ้าฟองขวา รอบวันที่เป็นวันธรรมดาถัดไป

ตัวอย่างเช่น ที่นี่เพื่อรับวันอาทิตย์ถัดไปของวันที่ในคอลัมน์ A

1. เลือกเซลล์ที่คุณต้องการวางวันอาทิตย์ถัดไป จากนั้นวางหรือป้อนสูตรด้านล่าง:

=IF(MOD(A2-1,7)>7,A2+7-MOD(A2-1,7)+7,A2+7-MOD(A2-1,7))

2. จากนั้นกด เข้าสู่ คีย์รับอาทิตย์หน้าแรกซึ่งแสดงเป็นตัวเลข 5 หลัก แล้วลากเติมอัตโนมัติลงไปได้ผลลัพธ์ทั้งหมด

doc-รอบไปก่อนหน้าอาทิตย์-1

3. จากนั้นเก็บเซลล์สูตรที่เลือกไว้ กด Ctrl + 1 ปุ่มเพื่อแสดงไฟล์ จัดรูปแบบเซลล์ กล่องโต้ตอบจากนั้นภายใต้ จำนวน เลือก วันที่ และเลือกประเภทวันที่จากรายการที่ถูกต้องตามที่คุณต้องการ คลิก OK.

doc-รอบไปก่อนหน้าอาทิตย์-1

ตอนนี้ผลลัพธ์ของสูตรแสดงในรูปแบบวันที่แล้ว

doc-รอบไปก่อนหน้าอาทิตย์-1

สำหรับวันธรรมดาถัดไป โปรดใช้สูตรด้านล่าง:

วันธรรมดา สูตร
วันอาทิตย์ =IF(MOD(A2-1,7)>7,A2+7-MOD(A2-1,7)+7,A2+7-MOD(A2-1,7))
วันเสาร์ =IF(MOD(A2-1,7)>6,A2+6-MOD(A2-1,7)+7,A2+6-MOD(A2-1,7))
วันศุกร์ =IF(MOD(A2-1,7)>5,A2+5-MOD(A2-1,7)+7,A2+5-MOD(A2-1,7))
วันพฤหัสบดี =IF(MOD(A2-1,7)>4,A2+4-MOD(A2-1,7)+7,A2+4-MOD(A2-1,7))
วันพุธ =IF(MOD(A1-1,7)>3,A1+3-MOD(A1-1,7)+7,A1+3-MOD(A1-1,7))
;วันอังคาร =IF(MOD(A1-1,7)>2,A1+2-MOD(A1-1,7)+7,A1+2-MOD(A1-1,7))
วันจันทร์ =IF(MOD(A1-1,7)>1,A1+1-MOD(A1-1,7)+7,A1+1-MOD(A1-1,7))

ลูกศรสีฟ้าฟองขวา รอบวันที่ก่อนหน้าวันทำงานที่ระบุ

ตัวอย่างเช่น ที่นี่เพื่อรับวันอาทิตย์ก่อนหน้าของวันที่ในคอลัมน์ A

1. เลือกเซลล์ที่คุณต้องการวางวันอาทิตย์ถัดไป จากนั้นวางหรือป้อนสูตรด้านล่าง:

=A2-วันธรรมดา(A2,2)

2. จากนั้นกด เข้าสู่ เพื่อรับวันอาทิตย์หน้าแรกจากนั้นลากการกรอกอัตโนมัติลงเพื่อรับผลลัพธ์ทั้งหมด

doc-รอบไปก่อนหน้าอาทิตย์-1

หากคุณต้องการเปลี่ยนรูปแบบวันที่ ให้เลือกเซลล์สูตรไว้ กด Ctrl + 1 ปุ่มเพื่อแสดงไฟล์ จัดรูปแบบเซลล์ กล่องโต้ตอบจากนั้นภายใต้ จำนวน เลือก วันที่ และเลือกประเภทวันที่จากรายการที่ถูกต้องตามที่คุณต้องการ คลิก OK.

doc-รอบไปก่อนหน้าอาทิตย์-1

ตอนนี้ผลลัพธ์ของสูตรแสดงในรูปแบบวันที่แล้ว

doc-รอบไปก่อนหน้าอาทิตย์-1

หากต้องการรับวันทำงานก่อนหน้า โปรดใช้สูตรด้านล่าง:

วันธรรมดา สูตร
วันอาทิตย์ =A2-วันธรรมดา(A2,2)
วันเสาร์ =IF(WEEKDAY(A2,2)>6,A2-WEEKDAY(A2,1),A2-WEEKDAY(A2,2)-1)
วันศุกร์ =IF(WEEKDAY(A2,2)>5,A2-WEEKDAY(A2,2)+5,A2-WEEKDAY(A2,2)-2)
วันพฤหัสบดี =IF(WEEKDAY(A2,2)>4,A2-WEEKDAY(A2,2)+4,A2-WEEKDAY(A2,2)-3)
วันพุธ =IF(WEEKDAY(A2,2)>3,A2-WEEKDAY(A2,2)+3,A2-WEEKDAY(A2,2)-4)
;วันอังคาร =IF(WEEKDAY(A2,2)>2,A2-WEEKDAY(A2,2)+2,A2-WEEKDAY(A2,2)-5)
วันจันทร์ =IF(WEEKDAY(A2,2)>1,A2-WEEKDAY(A2,2)+1,A2-WEEKDAY(A2,2)-6)

ตัวช่วยวันที่ & เวลาอันทรงพลัง

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

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

🤖 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 (16)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I have tested this but partially incorrect result was out. Why ?
I wanted to get next Friday.

=IF(A2="","",A2+5-Mod(A2-1,7))

I have entered 11/19/2022
The result was past day 11/18/2022
This comment was minimized by the moderator on the site
Thanks for your reminder, the original formula is not enough rigorous indeed. I have updated the formulas and rewrited the tutorial, hope the new formulas can help you.
This comment was minimized by the moderator on the site
Im trying to work out how to use a date, less an amount of days but ensure when subtracting the days it lands on a weekday not a weekend.
Any formulas??
This comment was minimized by the moderator on the site
Hi Everyone,
I use the formula below to round to the next Thursday where A1 is the cell with your original date and 14 is for Thursday. You can use other numbers for other days if required. 11=Monday, 12=Tuesday, 13=Wednesday, etc...

Also, you can use a 1 instead of an 8 to get the Thursday before your original date in A1. If your original date is already a Thursday the formula will produce the same date as in A1.

I hope this helps!

=A1+(0-WEEKDAY(A1,14)+8)
This comment was minimized by the moderator on the site
Thank you! This worked :)
This comment was minimized by the moderator on the site
I put this into google sheets and to make the dates become next thursday but I have not been able to get it to work especially for the dates right after thursdays. =IF(L2="","",L2+4-MOD(L2-1,4)) is the function i used to make it thursday but not all dates were thursday.
This comment was minimized by the moderator on the site
to clarify, all dates become thursday, but friday and saturday will not convert to the next weeks thursday instead they will go back a day or two to the previous thursday instead going to next weeks thursday, is there any way to fix this in the function =IF(L4="","",L4+4-MOD(L4-1,7))
This comment was minimized by the moderator on the site
Hi Kisho,

I use the formula below to round to the next Thursday where A1 is the cell with your original date and 14 is for Thursday. You can use other numbers for other days if required. 11=Monday, 12=Tuesday, 13=Wednesday, etc...

Also, you can use a 1 instead of an 8 to get the Thursday before your original date in A1. If your original date is already a Thursday the formula will produce the same date as in A1.

I hope this helps!

=A1+(0-WEEKDAY(A1,14)+8)
This comment was minimized by the moderator on the site
Hi Kisho,
I use the formula below to round to the next Thursday where A1 is the cell with your original date and 14 is for Thursday. You can use other numbers for other days if required. 11=Monday, 12=Tuesday, 13=Wednesday, etc...
Also, you can use a 1 instead of an 8 to get the Thursday before your original date in A1. If your original date is already a Thursday the formula will produce the same date as in A1.
I hope this helps!
=A1+(0-WEEKDAY(A1,14)+8)
This comment was minimized by the moderator on the site
I put this into google sheets and to make the dates become next thursday but I have not been able to get it to work especially for the dates right after thursdays. =IF(L2="","",L2+4-MOD(L2-1,4)) is the function i used to make it thursday but not all dates were thursday.
This comment was minimized by the moderator on the site
Si quiero la fecha del próximo viernes cómo debo modificar las variables? Gracias
This comment was minimized by the moderator on the site
Sorry, I cannot understand, could you speak in English?
This comment was minimized by the moderator on the site
hi guys,

I used the formula below, I hope it works for you.
IF(WEEKDAY(H2,16)<>7,(7-WEEKDAY(H2,16))+H2,H2) where H2 is the date that you want to round up to the next day of the week (in my case for Friday) and the 16 is the format to start the date with Saturday as #1 and Friday as #7.
This comment was minimized by the moderator on the site
Your round to previous Sunday is flawed. Even shows as much on your sheet.
This comment was minimized by the moderator on the site
So, what would be the correct formula to first check to see if a cell has a date, else leave it blank and make the date the fall on a Friday before if the date falls on a Saturday or Sunday?
This comment was minimized by the moderator on the site
I found a workaround for to the previous Friday. You can change the switch "results" as needed to round to different days.=H3-SWITCH(TEXT(H3, "DDD"), "Mon", 3, "Tue", 4, "Wed", 5, "Thu", 6, "Fri", 0, "Sat", 1, "Sun", 2)
=[date]-SWITCH(TEXT([date], "DDD"), "Mon", 3, "Tue", 4, "Wed", 5, "Thu", 6, "Fri", 0, "Sat", 1, "Sun", 2)
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations