Vai al contenuto principale

Come arrotondare la data al giorno della settimana specifico precedente o successivo in Excel?

doc-round-to-previous-domenica-1
A volte, potrebbe essere necessario ottenere il giorno della settimana specifico precedente o successivo come la domenica in base a una data mostrata nell'immagine a sinistra. Qui questo tutorial fornisce due formule per gestire facilmente questo lavoro in Excel.
Arrotonda la data al prossimo giorno della settimana specifico
Arrotondare la data al giorno della settimana specifico precedente

freccia blu freccia destra Arrotondare la data al prossimo giorno della settimana specifico

Ad esempio, qui per ottenere la domenica successiva delle date nella colonna A

1. Seleziona una cella in cui desideri posizionare la prossima data della domenica, quindi incolla o inserisci la formula seguente:

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

2. Quindi premere entrare per ottenere la prima domenica successiva, che viene visualizzata come un numero di 5 cifre, quindi trascina il riempimento automatico verso il basso per ottenere tutti i risultati.

doc-round-to-previous-domenica-1

3. Quindi mantieni selezionate le celle della formula, premi Ctrl + 1 per visualizzare il file formato celle dialogo, quindi sotto Numero scheda, selezionare Data e scegli un tipo di data dall'elenco di destra di cui hai bisogno. Clic OK.

doc-round-to-previous-domenica-1

Ora i risultati della formula sono stati mostrati in formato data.

doc-round-to-previous-domenica-1

Per ottenere il prossimo altro giorno della settimana, utilizzare le formule seguenti:

giorno feriale Formula
Domenica =IF(MOD(A2-1,7)>7,A2+7-MOD(A2-1,7)+7,A2+7-MOD(A2-1,7))
Sabato =IF(MOD(A2-1,7)>6,A2+6-MOD(A2-1,7)+7,A2+6-MOD(A2-1,7))
Venerdì =IF(MOD(A2-1,7)>5,A2+5-MOD(A2-1,7)+7,A2+5-MOD(A2-1,7))
Giovedì =IF(MOD(A2-1,7)>4,A2+4-MOD(A2-1,7)+7,A2+4-MOD(A2-1,7))
Mercoledì =IF(MOD(A1-1,7)>3,A1+3-MOD(A1-1,7)+7,A1+3-MOD(A1-1,7))
;Martedì =IF(MOD(A1-1,7)>2,A1+2-MOD(A1-1,7)+7,A1+2-MOD(A1-1,7))
Lunedì =IF(MOD(A1-1,7)>1,A1+1-MOD(A1-1,7)+7,A1+1-MOD(A1-1,7))

freccia blu freccia destra Arrotondare la data al giorno della settimana specifico precedente

Ad esempio, qui per ottenere la domenica precedente delle date nella colonna A

1. Seleziona una cella in cui desideri posizionare la prossima data della domenica, quindi incolla o inserisci la formula seguente:

=A2-GIORNO DELLA SETTIMANA(A2,2)

2. Quindi premere entrare per ottenere la prima domenica successiva, quindi trascina il riempimento automatico verso il basso per ottenere tutti i risultati.

doc-round-to-previous-domenica-1

Se vuoi cambiare il formato della data, mantieni selezionate le celle della formula, premi Ctrl + 1 per visualizzare il file formato celle dialogo, quindi sotto Numero scheda, selezionare Data e scegli un tipo di data dall'elenco di destra di cui hai bisogno. Clic OK.

doc-round-to-previous-domenica-1

Ora i risultati della formula sono stati mostrati in formato data.

doc-round-to-previous-domenica-1

Per ottenere l'altro giorno della settimana precedente, utilizzare le formule seguenti:

giorno feriale Formula
Domenica =A2-GIORNO DELLA SETTIMANA(A2,2)
Sabato =IF(WEEKDAY(A2,2)>6,A2-WEEKDAY(A2,1),A2-WEEKDAY(A2,2)-1)
Venerdì =IF(WEEKDAY(A2,2)>5,A2-WEEKDAY(A2,2)+5,A2-WEEKDAY(A2,2)-2)
Giovedì =IF(WEEKDAY(A2,2)>4,A2-WEEKDAY(A2,2)+4,A2-WEEKDAY(A2,2)-3)
Mercoledì =IF(WEEKDAY(A2,2)>3,A2-WEEKDAY(A2,2)+3,A2-WEEKDAY(A2,2)-4)
;Martedì =IF(WEEKDAY(A2,2)>2,A2-WEEKDAY(A2,2)+2,A2-WEEKDAY(A2,2)-5)
Lunedì =IF(WEEKDAY(A2,2)>1,A2-WEEKDAY(A2,2)+1,A2-WEEKDAY(A2,2)-6)

Potente aiutante di data e ora

Le Data e ora Helper caratteristica di Kutools for Excel, supporta facilmente l'aggiunta/sottrazione della data, il calcolo della differenza tra due date e il calcolo dell'età in base al compleanno.  Fare clic per la prova gratuita!
doc-round-to-previous-domenica-1
 
Kutools per Excel: con oltre 200 pratici componenti aggiuntivi di Excel, provabili gratuitamente senza limitazioni.

I migliori strumenti per la produttività in ufficio

🤖 Assistente AI di Kutools: Rivoluziona l'analisi dei dati basandosi su: Esecuzione intelligente   |  Genera codice  |  Crea formule personalizzate  |  Analizzare i dati e generare grafici  |  Richiama le funzioni di Kutools...
Funzioni popolari: Trova, evidenzia o identifica i duplicati   |  Elimina righe vuote   |  Combina colonne o celle senza perdere dati   |   Round senza formula ...
Super ricerca: VLookup a criteri multipli    VLookup a valori multipli  |   VLookup su più fogli   |   Ricerca fuzzy ....
Elenco a discesa avanzato: Crea rapidamente un elenco a discesa   |  Elenco a discesa dipendente   |  Elenco a discesa a selezione multipla ....
Gestore di colonna: Aggiungi un numero specifico di colonne  |  Sposta colonne  |  Attiva/disattiva lo stato di visibilità delle colonne nascoste  |  Confronta intervalli e colonne ...
Funzionalità in primo piano: Messa a fuoco della griglia   |  Vista di progettazione   |   Grande barra delle formule    Gestore di cartelle di lavoro e fogli   |  Resource Library (Testo automatico)   |  Date picker   |  Combina fogli di lavoro   |  Crittografa/decrittografa le celle    Invia e-mail per elenco   |  Super filtro   |   Filtro speciale (filtro grassetto/corsivo/barrato...) ...
I 15 migliori set di strumenti12 Testo Strumenti (aggiungi testo, Rimuovi personaggi, ...)   |   50+ Grafico Tipi (Diagramma di Gantt, ...)   |   40+ Pratico Formule (Calcola l'età in base al compleanno, ...)   |   19 Inserimento Strumenti (Inserisci il codice QR, Inserisci immagine dal percorso, ...)   |   12 Conversione Strumenti (Numeri in parole, Conversione di valuta, ...)   |   7 Unisci e dividi Strumenti (Combina righe avanzate, Celle divise, ...)   |   ... e altro ancora

Potenzia le tue competenze di Excel con Kutools per Excel e sperimenta l'efficienza come mai prima d'ora. Kutools per Excel offre oltre 300 funzionalità avanzate per aumentare la produttività e risparmiare tempo.  Fai clic qui per ottenere la funzionalità di cui hai più bisogno...

Descrizione


Office Tab porta l'interfaccia a schede in Office e semplifica notevolmente il tuo lavoro

  • Abilita la modifica e la lettura a schede in Word, Excel, PowerPoint, Publisher, Access, Visio e Project.
  • Apri e crea più documenti in nuove schede della stessa finestra, piuttosto che in nuove finestre.
  • Aumenta la produttività del 50% e riduce ogni giorno centinaia di clic del mouse!
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