Note: The other languages of the website are Google-translated. Back to English
Logáil isteach  \/ 
x
or
x
Cláraigh  \/ 
x

or

Conas líon na deireadh seachtaine / laethanta seachtaine a chomhaireamh idir dhá dháta in Excel?

Uaireanta, caithfimid a fháil amach cé mhéad lá sonrach seachtaine idir dhá dháta. Mar shampla, tá dhá dháta agam: is é an dáta tosaigh 1/1/2014 agus is é an dáta deiridh 2/15/2014, anois ba mhaith liom a fháil amach cé mhéad uair a tharlaíonn Dé Domhnaigh nó Dé Luain nó Dé Máirt srl sa ré seo. B’fhéidir go bhfuil sé seo deacair dúinn, ach anseo, is féidir liom labhairt faoi roinnt modhanna éifeachtacha duitse.


Líon na laethanta / deireadh seachtaine ar leith a chomhaireamh idir dhá dháta leis an bhfoirmle

Ag ceapadh, tá an dá dháta seo a leanas agam, agus ní mór dom a áireamh cé mhéad Domhnach eatarthu. Roghnaigh cill bhán, iontráil thíos an fhoirmle, agus brúigh an Iontráil eochair. Agus anois gheobhaidh tú líon na Domhnach idir an dá dháta. Féach an pictiúr:

=INT((WEEKDAY($C$2- 1)-$C$2+$C3)/7)

Nótaí:

(1) San fhoirmle thuas, is é C2 an dáta tosaigh agus léiríonn C3 an dáta deiridh.

(2) San fhoirmle thuas, 1 Seasann don Domhnach. Agus is féidir leat uimhreacha eile a chur in ionad uimhir 1 idir 1 agus 7. (Is é 1 Dé Domhnaigh, 2 Dé Luain, 3 Dé Máirt, 4 Dé Céadaoin, 5 Déardaoin, 6 Dé hAoine agus 7 Dé Sathairn)


Úsáid foirmle chun líon na laethanta seachtaine ar leith a chomhaireamh i mí

Uaireanta, b’fhéidir go mbeidh ort líon iomlán lá áirithe seachtaine a chomhaireamh sa mhí ar leith, a deir líon iomlán Dé Céadaoin i mí Iúil, 2020 a chomhaireamh. Anseo, tabharfaidh mé foirmle isteach chun líon iomlán lá áirithe seachtaine a chomhaireamh sa shonraithe mí go héasca.

Roghnaigh cill bhán, clóscríobh thíos an fhoirmle, agus brúigh an Iontráil eochair chun an toradh comhairimh a fháil.

=INT((WEEKDAY(DATE(G2,G3,1)- G4)-DATE(G2,G3,1)+EOMONTH(DATE(G2,G3,1),0))/7)

nótaí:

(1) San fhoirmle thuas, is í G2 an bhliain shonraithe, is é G3 an mhí shonraithe, agus is é G4 an lá sonraithe den tseachtain.

(2) Sannann an fhoirmle seo slánuimhreacha chun lá na seachtainí a léiriú: is é 1 Dé Domhnaigh, 2 Dé Luain, 3 Dé Máirt, 4 Dé Céadaoin, 5 Déardaoin, 6 Dé hAoine, 7 Dé hAoine, agus XNUMX Dé Sathairn.


Úsáid Feidhm Shainithe Úsáideora chun líon na laethanta / deireadh seachtaine ar leith a chomhaireamh i mí ar leith

Is féidir leat Feidhm Sainmhínithe ag Úsáideoir a chruthú freisin chun a ríomh cé mhéad lá seachtaine ar leith i mbliain agus mí ar leith seachas an fhoirmle thuas.

1. Coinnigh síos an ALT + F11 eochracha, agus osclaíonn sé an Fuinneog Microsoft Visual Basic for Applications.

2. Cliceáil Ionsáigh > Modúil, agus greamaigh an cód seo a leanas sa Fuinneog an Mhodúil.

Public Function TotalDays(pYear As Integer, pMonth As Integer, pDay As Integer)
'Update 20140210
Dim xindex As Integer
Dim endDate As Integer
endDate = Day(DateSerial(pYear, pMonth + 1, 0))
For xindex = 1 To endDate
    If Weekday(DateSerial(pYear, pMonth, xindex)) = pDay Then
        TotalDays = TotalDays + 1
    End If
Next
End Function

3. Sábháil an cód seo agus filleadh ar an mbileog oibre, ansin i gcill bhán, iontráil an fhoirmle seo = TotalDays (bliain, mí, 1) . Sa sampla seo, comhaireamhfaidh mé cé mhéad Domhnach atá ann i Meitheamh 2020, ionas gur féidir liom an fhoirmle seo a chur i bhfeidhm mar cheann de na foirmlí thíos, ansin brúigh Iontráil eochair, agus gheobhaidh tú cé mhéad Domhnach ag an am céanna. féach screenshots:

= Iomlán na laethanta (C2, C3, C4)

= Iomlán na laethanta (2020,6,1)

 

Nótaí: Úsáideann na foirmlí seo slánuimhreacha chun lá na seachtainí a léiriú: Is é 1 Dé Domhnaigh, 2 Dé Luain, 3 Dé Máirt, 4 Dé Céadaoin, 5 Déardaoin, 6 Dé hAoine agus 7 Dé Sathairn.


Líon líon na deireadh seachtaine / laethanta seachtaine / lá sonrach den tseachtain idir dhá dháta le Kutools for Excel

I ndáiríre, is féidir linn Kutools a chur i bhfeidhm ar Excel's Líon na laethanta neamh-oibre idir dhá dháta foirmle, Líon na laethanta oibre idir dhá dháta foirmle, agus Líon na laethanta sonracha seachtaine a chomhaireamh foirmle chun líon na deireadh seachtaine, an deireadh seachtaine, nó lá sonrach na seachtaine a chomhaireamh go tapa i raon dáta in Excel.

Kutools le haghaidh Excel - Cuimsíonn sé níos mó ná 300 uirlis áisiúil le haghaidh Excel. Triail saor in aisce gné iomlán 30 lá, níl aon chárta creidmheasa ag teastáil! Triail In Aisce Anois!

1. Roghnaigh cill bhán cuirfidh tú toradh an chomhairimh, agus cliceáil Kutools> Helper Foirmle> Helper Foirmle chun an ghné seo a chumasú

Agus ansin dul ar aghaidh bunaithe ar do chineálacha comhairimh.

A. Líon na deireadh seachtaine (Dé Sathairn agus Dé Domhnaigh) a chomhaireamh idir dhá dháta in Excel

Sa dialóg Helper Formulas, déan mar a leanas:
(1) Roghnaigh Staidrimh ó na Cineál Foirmle liosta anuas;
(2) Cliceáil chun roghnú Líon na laethanta neamh-oibre idir dhá dháta sa Roghnaigh foirmle bosca liosta;
(3) Iontráil an dáta tosaigh sa Tosaigh Dáta bosca (is féidir leat cill dáta a tharchur freisin);
(4) Iontráil an dáta deiridh sa Dáta Deiridh bosca (is féidir leat cill dáta a tharchur freisin);
(5) Cliceáil ar an OK cnaipe.

Anois cuireann sé líon iomlán na Satharn agus an Domhnaigh ar fad sa chill roghnaithe ar ais.

Kutools le haghaidh Excel - Cuimsíonn sé níos mó ná 300 uirlis áisiúil le haghaidh Excel. Triail saor in aisce gné iomlán 30 lá, níl aon chárta creidmheasa ag teastáil! Get sé anois

B. Líon na laethanta i rith na seachtaine (gan an Satharn agus an Domhnach san áireamh) idir dhá dháta in Excel

Sa dialóg Helper Formulas, déan mar a leanas:
(1) Roghnaigh Staidrimh ó na Cineál Foirmle liosta anuas;
(2) Cliceáil chun roghnú Líon na laethanta oibre idir dhá dháta sa Roghnaigh foirmle bosca liosta;
(3) Iontráil an dáta tosaigh sa Tosaigh Dáta bosca (is féidir leat cill dáta a tharchur freisin);
(4) Iontráil an dáta deiridh sa Dáta Deiridh bosca (is féidir leat cill dáta a tharchur freisin);
(5) Cliceáil ar an OK cnaipe.

Agus ansin tugann sé líon iomlán laethanta na seachtaine ar ais (gan an Satharn agus an Domhnach san áireamh) sa chill roghnaithe.

Kutools le haghaidh Excel - Cuimsíonn sé níos mó ná 300 uirlis áisiúil le haghaidh Excel. Triail saor in aisce gné iomlán 30 lá, níl aon chárta creidmheasa ag teastáil! Get sé anois

C. Líon líon na laethanta faoi leith den tseachtain (Dé Luain, Dé Sathairn, Dé Domhnaigh, srl) idir dhá dháta in Excel

Sa dialóg Helper Formulas, déan mar a leanas:
(1) Roghnaigh Staidrimh ó na Cineál Foirmle liosta anuas;
(2) Cliceáil chun roghnú Líon na laethanta sonracha seachtaine a chomhaireamh sa Roghnaigh foirmle bosca liosta;
(3) Iontráil an dáta tosaigh sa Tosaigh Dáta bosca (is féidir leat cill dáta a tharchur freisin);
(4) Iontráil an dáta deiridh sa Dáta Deiridh bosca (is féidir leat cill dáta a tharchur freisin);
(5) Sonraigh an lá sonrach seachtaine le slánuimhir (1 le fios Dé Domhnaigh, ciallaíonn 2-5 Dé Luain go hAoine, agus 7 Dé Sathairn.);
(6) Cliceáil ar an OK cnaipe.

Agus ansin cuireann sé líon iomlán an lae shonraithe seachtaine ar ais sa raon dáta ar leith.

Kutools le haghaidh Excel - Cuimsíonn sé níos mó ná 300 uirlis áisiúil le haghaidh Excel. Triail saor in aisce gné iomlán 30 lá, níl aon chárta creidmheasa ag teastáil! Get sé anois


Earraí gaolmhara:


Na hUirlisí Táirgiúlachta Oifige is Fearr

Réitíonn Kutools for Excel an chuid is mó de do chuid Fadhbanna, agus Méadaíonn sé do Tháirgiúlacht 80%

  • Athúsáid: Cuir isteach go tapa foirmlí casta, cairteacha agus aon rud a d'úsáid tú roimhe seo; Cealla a Chriptiú le pasfhocal; Cruthaigh Liosta Ríomhphoist agus seol ríomhphoist ...
  • Barra Foirmle Super (cuir línte iolracha téacs agus foirmle in eagar go héasca); Leagan Amach Léitheoireachta (líon mór cealla a léamh agus a chur in eagar go héasca); Greamaigh go dtí an Raon Scagtha...
  • Cumaisc Cealla / Sraitheanna / Colúin gan Sonraí a chailleadh; Ábhar Cealla Scoilt; Comhcheangail Sraitheanna / Colúin Dúblacha... Cill Dúblach a Chosc; Déan comparáid idir Ranganna...
  • Roghnaigh Dúblach nó Uathúil Sraitheanna; Roghnaigh Blank Rows (tá na cealla uile folamh); Aimsigh Super agus Fuzzy Aimsigh i go leor Leabhar Oibre; Roghnaigh go randamach ...
  • Cóip Díreach Cealla Il gan tagairt fhoirmle a athrú; Tagairtí Cruthaigh Auto chuig Bileoga Il; Cuir Urchair isteach, Boscaí Seiceála agus go leor eile ...
  • Sliocht Téacs, Cuir Téacs leis, Bain de réir Poist, Bain Spás; Subtotals Paging a chruthú agus a phriontáil; Tiontaigh Idir Ábhar Cealla agus Tráchtanna...
  • Scagaire Super (scéimeanna scagaire a shábháil agus a chur i bhfeidhm ar bhileoga eile); Ard-Sórtáil de réir míosa / seachtaine / lae, minicíocht agus níos mó; Scagaire Speisialta le cló trom, iodálach ...
  • Comhcheangail Leabhair Oibre agus Bileoga Oibre; Cumaisc Táblaí bunaithe ar eochaircholúin; Roinn Sonraí i Ilbhileoga; Baisc Tiontaigh xls, xlsx agus PDF...
  • Níos mó ná 300 gné chumhachtach. Tacaíochtaí Office / Excel 2007-2019 agus 365. Tacaíonn sé le gach teanga. Imscaradh éasca i d’fhiontar nó d’eagraíocht. Gnéithe iomlána triail saor in aisce 30 lá. Ráthaíocht ar ais airgid 60 lá.
cluaisín kte 201905

Tugann Tab Oifige comhéadan Tabbed chuig Office, agus Déan Do Obair i bhfad Níos Éasca

  • Cumasaigh eagarthóireacht agus léamh tabbed i Word, Excel, PowerPoint, Foilsitheoir, Rochtain, Visio agus Tionscadal.
  • Oscail agus cruthaigh cáipéisí iolracha i gcluaisíní nua den fhuinneog chéanna, seachas i bhfuinneoga nua.
  • Méadaíonn do tháirgiúlacht 50%, agus laghdaíonn sé na céadta cad a tharlaíonn nuair luch duit gach lá!
bun officetab
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Mohamed · 4 years ago
    Let's say you want to calculate the 3rd Thursday of the month and assume the date of the first of the month is in cell A1.

    We need to first work out the date of the Thursday in the week of A1. Because Thursday is the 5th day of the week, we use:

    [b]=[u]A1-WEEKDAY(A1)+5[/u][/b]

    Then if this Thursday falls before A1, we need to add 7 using

    [b](([u]A1-WEEKDAY(A1)+5[/u])
  • To post as a guest, your comment is unpublished.
    Jon · 4 years ago
    What about a formula that returns the actual date of the first Wed of each month, Or the 2nd and 3rd tuesday of each month?
    Or every 3rd tuesday?

    I want to be able to put in my own start and end dates and then get the actual DATES (not the count) returned to me. Any ideas?
  • To post as a guest, your comment is unpublished.
    KAMBLE VIJAY · 5 years ago
    hi sir,
    i want to calculate no. of weeks in excel between two dates, but Dose not see right weeks as per date
    for example: I enterd the date 01/01/2016 ( Friday) and second date 14/01/2016( thursday) no of weeks showing = 2 weeks.
    but i want to show exact 2 weeks completed 15/01/2016 other wise show previse no fo weeks.
    • To post as a guest, your comment is unpublished.
      Mohamed · 5 years ago
      Let the start and end dates be in cells A1 and A2, respectively. This should work:

      =INT((A2-A1)/7)
  • To post as a guest, your comment is unpublished.
    Rob Mormile · 6 years ago
    Is it possible to have the start date set to "=today()" and the end date, for example, the 22nd of the current cycle. As the date returns to the 23rd, refresh the formula to the following 22nd?
    • To post as a guest, your comment is unpublished.
      Mohamed · 5 years ago
      Assuming cycle refers to month, this should work for the end date:

      DATE(YEAR(TODAY()),MONTH(TODAY())+IF(DAY(TODAY())>22,1,0),22)
  • To post as a guest, your comment is unpublished.
    Mohamed · 6 years ago
    Why are my comments not published completely????
    • To post as a guest, your comment is unpublished.
      Admin_jay · 6 years ago
      [quote name="Mohamed"]Why are my comments not published completely????[/quote]
      Sorry, please try to send me the formula to jaychivo#extendoffice.com. Please replace @ with #.

      And i will help you post it. May be there are some characters which have been blocked. :-)
  • To post as a guest, your comment is unpublished.
    Mohamed · 6 years ago
    Hi Jaco,
    You may achieve this for someone who works Mondays (2), Wednesdays (4) and Fridays (6) as follows:

    (1) Call the year's start and end dates [quote]StartDate[/quote] and [quote]EndDate[/quote], respectively.
    (2) List all the public holidays in South Africa (this could span more than one year) in a range and call it [quote]PublicHolidays[/quote]
    (3) To calculate the total number of days worked enter the following [b]array[/b] formula:
    [quote]=INT((WEEKDAY(StartDate-2)-StartDate+EndDate )/7)+INT((WEEKDAY(StartDate-4)-StartDate+EndDate )/7)+INT((WEEKDAY(StartDate-6)-StartDate+EndDate )/7)-SUM(IF((PublicHolidays>=StartDate)*(PublicHolidays
    • To post as a guest, your comment is unpublished.
      Mohamed · 6 years ago
      Sorry the formula above is not complete: It should be:

      =INT((WEEKDAY(StartDate-[b]2[/b])-StartDate+EndDate)/7)+INT((WEEKDAY(StartDate-[b]4[/b])-StartDate+EndDate)/7)+INT((WEEKDAY(StartDate-[b]6[/b])-StartDate+EndDate)/7)-SUM(IF((PublicHolidays>=StartDate)*(PublicHolidays
    • To post as a guest, your comment is unpublished.
      Mohamed · 6 years ago
      I don't know what happened to my formula and the rest of my message above. The formula should be:

      =INT((WEEKDAY(StartDate-2)-StartDate+EndDate )/7)+INT((WEEKDAY(StartDate-4)-StartDate+EndDate)/7)+INT((WEEKDAY(StartDate-6)-StartDate+EndDate )/7)-SUM(IF((PublicHolidays>=StartDate)*(PublicHolidays
  • To post as a guest, your comment is unpublished.
    Jaco · 6 years ago
    Hi, I am from South Africa and I need advice.
    I have two workers at work who works different days. Now I want to type in a formula in excel to count how many days a year she work (that I can do), but the trick comes in when I want to type in a formula which allows me to deduct if one of her working days is a public holiday for example she works Monday, Wednesday and Friday. That means she works 156 days per year, but I want excel to deduct the holidays if it is on one of her working days. Can someone please assist me?
  • To post as a guest, your comment is unpublished.
    Laura Tigers · 7 years ago
    Does not work properly. You need to consider what day you're starting from and ending with!
    • To post as a guest, your comment is unpublished.
      Mohamed · 6 years ago
      Hi Laura,
      Could you please elaborate?
  • To post as a guest, your comment is unpublished.
    PhilT · 7 years ago
    Thank you for this.
    Question, how do I add another day like "Wednesday or 4" to the Monday? Basically I want it to calculate both the total of Mondays and Wednesdays between the two dates. How do I write this formula?
    Thanks again
    • To post as a guest, your comment is unpublished.
      JamesB · 6 years ago
      To help future seekers.
      Use this formula for calculating days between two dates:
      =NETWORKDAYS.INTL( start_date, end_date, [weekend], [holidays] )
      =NETWORKDAYS.INTL(A3,A4,"00000011",C3:C8) - 0=include day 1=exclude day
      • To post as a guest, your comment is unpublished.
        Vasyl · 3 months ago
        THANK YOU VERY MUCH!!! This is perfect! This function exactly does the task! 
    • To post as a guest, your comment is unpublished.
      Mohamed · 7 years ago
      Try
      =INT((WEEKDAY($B$1-2)-$B$1+$B2)/7)+INT((WEEKDAY($B$1-4)-$B$1+$B2)/7)
      • To post as a guest, your comment is unpublished.
        Saravanan · 5 years ago
        Thank You. This is so useful.