Skip i'r prif gynnwys

Sut i drosi rhif wythnos hyd yma neu i'r gwrthwyneb yn Excel?

A oes ffordd i gael rhif yr wythnos o ddyddiad penodol neu dynnu'r ystod dyddiad o rif wythnos a blwyddyn benodol yn Excel? I ddatrys y dasg hon, gall y fformwlâu canlynol ffafrio chi.

Trosi rhif yr wythnos hyd yma gyda fformwlâu

Trosi rhif i wythnos yr wythnos gyda fformwlâu


Trosi rhif yr wythnos hyd yma gyda fformwlâu

Gan dybio bod gen i rif blwyddyn ac wythnos ar hap sef 2015 a 15 mewn taflen waith fel y llun isod, a nawr rydw i eisiau darganfod y dyddiadau penodol o ddydd Llun i ddydd Sul erbyn y rhif wythnos penodol hwn.

I gyfrifo'r ystod dyddiad yn ôl y rhif wythnos penodol, gallwch ddefnyddio'r fformwlâu canlynol:

1. Dewiswch gell wag byddwch yn dychwelyd y dyddiad cychwyn (yn ein hachos ni, rydym yn dewis y Cell B5), nodwch y fformiwla: =MAX(DATE(B1,1,1),DATE(B1,1,1)-WEEKDAY(DATE(B1,1,1),2)+(B2-1)*7+1), a gwasgwch y Rhowch allwedd. Gweler y screenshot isod:

2. Dewiswch gell wag arall y byddwch chi'n dychwelyd y dyddiad gorffen (yn ein hachos ni, rydyn ni'n dewis y Cell B6), nodwch =MIN(DATE(B1+1,1,0),DATE(B1,1,1)-WEEKDAY(DATE(B1,1,1),2)+B2*7), a gwasgwch y Rhowch allwedd. Gweler y screenshot isod:

rhuban nodyn Mae fformiwla yn rhy gymhleth i'w gofio? Cadwch y fformiwla fel cofnod Testun Auto i'w ailddefnyddio gyda dim ond un clic yn y dyfodol!
Darllen mwy…     Cyfnod treialu am ddim

Nodyn: Yn y ddau fformiwla uchod, B1 yn cynnwys blwyddyn a B2 yn rhif wythnos penodedig, gallwch newid y dadleuon i'ch angen).

3. Fel y gwelwch, mae'r ddau fformiwla yn dychwelyd rhifau yn lle dyddiadau. Daliwch i ddewis y ddau gyfrifo canlyniadau, a chlicio Hafan > Fformat Rhif blwch> Dyddiad Byr i newid y rhifau i ddyddiadau. Gweler y screenshot isod:

Un clic i drosi dyddiadau / rhifau / testun fformatio ansafonol lluosog i ddyddiadau arferol yn Excel

Kutools ar gyfer Excel's Trosi hyd yn hyn gall cyfleustodau eich helpu chi i adnabod a throsi dyddiadau neu rifau ansafonol (yyyymmdd) neu destun i ddyddiadau arferol gyda dim ond un clic yn Excel.


trosi hyd yn 1

Trosi rhif i wythnos yr wythnos gyda fformwlâu

Ar y llaw arall, gallwch hefyd gymhwyso'r swyddogaeth WYTHNOS i drosi dyddiad i rif wythnos cyfatebol.

1. Dewiswch gell wag y byddwch yn dychwelyd rhif yr wythnos, nodwch y fformiwla hon: = WYTHNOS (B1,1), a gwasgwch y fysell Enter. Gweler y screenshot:

Nodiadau:

(1) Yn y fformiwla uchod, B1 yn cynnwys y dyddiad rydych chi am ei ddefnyddio.

(2) Os bydd angen i chi ddychwelyd rhif yr wythnos o ddyddiad sy'n dechrau ddydd Llun, defnyddiwch y fformiwla hon: = WYTHNOS (B1,2).


Erthyglau cysylltiedig:

Sut i gyfrif nifer y diwrnodau wythnos penodol rhwng dau ddyddiad yn Excel?

Sut i ychwanegu / tynnu diwrnodau / misoedd / blynyddoedd hyd yma yn Excel?

Offer Cynhyrchiant Swyddfa Gorau

🤖 Kutools AI Aide: Chwyldro dadansoddi data yn seiliedig ar: Cyflawniad Deallus   |  Cynhyrchu Cod  |  Creu Fformiwlâu Personol  |  Dadansoddi Data a Chynhyrchu Siartiau  |  Invoke Swyddogaethau Kutools...
Nodweddion Poblogaidd: Darganfod, Amlygu neu Adnabod Dyblygiadau   |  Dileu Rhesi Gwag   |  Cyfuno Colofnau neu Gelloedd heb Colli Data   |   Rownd heb Fformiwla ...
Super-edrych: VLookup Meini Prawf Lluosog    VLookup Gwerth Lluosog  |   VLookup Ar Draws Taflenni Lluosog   |   Edrych Niwlog ....
Rhestr gwympo Uwch: Creu Rhestr Gollwng yn Gyflym   |  Rhestr Gollwng Dibynnol   |  Rhestr Gollwng Aml-ddewis ....
Rheolwr Colofn: Ychwanegu Nifer Penodol o Golofnau  |  Symud Colofnau  |  Toglo Statws Gwelededd Colofnau Cudd  |  Cymharwch Ystodau a Cholofnau ...
Nodweddion dan Sylw: Ffocws ar y Grid   |  Golwg Dylunio   |   Bar Fformiwla Mawr    Rheolwr Llyfr Gwaith a Thaflen   |  Llyfrgell Adnoddau (Testun Auto)   |  Dewiswr Dyddiad   |  Cyfuno Taflenni Gwaith   |  Amgryptio/Dadgryptio Celloedd    Anfon E-byst trwy Restr   |  Hidlo Super   |   Hidlo Arbennig (hidlo mewn print trwm/italig/strikethrough...) ...
15 Set Offer Gorau12 Testun offer (Ychwanegu Testun, Dileu Cymeriadau,...)   |   50 + Siart Mathau (Siart Gantt,...)   |   40+ Ymarferol Fformiwlâu (Cyfrifwch oedran yn seiliedig ar ben-blwydd,...)   |   19 mewnosod offer (Mewnosod Cod QR, Mewnosod Llun o'r Llwybr,...)   |   12 Trosi offer (Rhifau i Eiriau, Trosi arian cyfred,...)   |   7 Uno a Hollti offer (Rhesi Cyfuno Uwch, Celloedd Hollt,...)   |   ... a mwy

Supercharge Eich Sgiliau Excel gyda Kutools ar gyfer Excel, a Phrofiad Effeithlonrwydd Fel Erioed Erioed. Kutools ar gyfer Excel Yn Cynnig Dros 300 o Nodweddion Uwch i Hybu Cynhyrchiant ac Arbed Amser.  Cliciwch Yma i Gael Y Nodwedd Sydd Ei Angen Y Mwyaf...

Disgrifiad


Mae Office Tab yn dod â rhyngwyneb Tabbed i Office, ac yn Gwneud Eich Gwaith yn Haws o lawer

  • Galluogi golygu a darllen tabbed yn Word, Excel, PowerPoint, Cyhoeddwr, Mynediad, Visio a Phrosiect.
  • Agor a chreu dogfennau lluosog mewn tabiau newydd o'r un ffenestr, yn hytrach nag mewn ffenestri newydd.
  • Yn cynyddu eich cynhyrchiant 50%, ac yn lleihau cannoedd o gliciau llygoden i chi bob dydd!
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