Clean Excel dates and calculate a duration

Autor: AILesson6 min de configuraçãoTestado com:ChatGPTRevisado em: 2026-08-28

Resposta rápida

Normalize mixed date inputs before calculating calendar or working time. Forneça: Observed date values, Columns and desired result, Duration rules. Resultado esperado: A safe conversion and duration method with locale and boundary tests.

1

Adicione seu contexto

Seu texto permanece neste navegador. O AILesson Prompts não o envia para um modelo ou servidor.

2

Seu prompt

Campos não preenchidos permanecem visíveis como marcadores de posição, para que você ainda possa copiar e editar o prompt

Design a safe Excel method to normalize dates and calculate duration.

Observed inputs:
[inputs]

Workbook layout and desired result:
[layout]

Duration rules:
[rules]

First distinguish real Excel serial dates from text and identify ambiguous locale-dependent values. Do not guess whether 03/04 means March 4 or April 3. Propose helper columns for normalization and validation before duration calculation. Return formulas, cell formats, invalid-value flags, and tests for blanks, timestamps, reversed dates, leap days, and boundary inclusion. State whether the result is elapsed time, calendar days, or working days.
Experimente no Playground
Privado por padrãoA montagem do prompt acontece localmente no seu navegador. Evite colocar informações confidenciais em qualquer serviço de IA, a menos que sua organização permita.

Da entrada ao resultado

Um exemplo prático

Veja como um contexto concreto transforma esta receita em um resultado útil

Entrada real

Observed date values
B contains real Excel dates or ISO text such as 2026-02-27; C contains real dates, ISO text, or blank for open cases. Values like 03/04/2026 may occur and must be flagged as ambiguous. Some cells include timestamps.
Columns and desired result
B: Started; C: Completed; D: Clean Start; E: Clean Complete; F: Calendar Days. Data starts at row 2.
Duration rules
Use 1 March 2026 for open cases in this fixed report. Count elapsed calendar days, so same-day completion is 0. Preserve timestamps only long enough to remove them. Reversed dates must show Review.

Exemplo de saída

Use helper columns so conversion problems remain visible.

D2 clean start: =IF(B2="","",IF(ISNUMBER(B2),INT(B2),IF(AND(LEN(B2)=10,MID(B2,5,1)="-",MID(B2,8,1)="-"),DATE(LEFT(B2,4),MID(B2,6,2),RIGHT(B2,2)),"Review")))

E2 clean complete: use the same conversion for C2, but return DATE(2026,3,1) when C2 is blank.

F2 elapsed calendar days: =IF(OR(D2="Review",E2="Review",D2=""),"Review",IF(E2<D2,"Review",E2-D2)). Format D:E as an unambiguous date such as yyyy-mm-dd and F as a number.

The formula accepts serial dates and exactly shaped ISO text. It deliberately flags 03/04/2026. INT removes time from serial values. Tests: same day → 0; 27 Feb to 1 Mar 2026 → 2; blank completion uses 1 Mar; 29 Feb 2024 parses correctly; completion before start → Review. Validate imported ISO strings with impossible months or days because DATE can roll invalid components forward.

Por que isso funciona

  1. 1

    Normalization separates data conversion failures from duration logic.

  2. 2

    Refusing ambiguous locale formats prevents plausible but incorrect dates.

Verifique o resultado

  • Are ambiguous text dates flagged instead of guessed?

  • Is inclusivity defined for same-day and end-date cases?

  • Are negative durations visible as data errors?

Use com confiança

Perguntas frequentes

Respostas práticas sobre quando usar esta receita, o que fornecer e onde a revisão humana ainda é importante

What should I prepare before using “Clean Excel dates and calculate a duration”?

For “Clean Excel dates and calculate a duration,” prepare Observed date values, Columns and desired result, and Duration rules. Replace placeholders only with information you can verify. If a detail is unknown, preserve that uncertainty explicitly instead of asking the model to infer it.

When is the “Clean Excel dates and calculate a duration” result not ready to use?

The result is not ready if it does not yet deliver the stated outcome—A safe conversion and duration method with locale and boundary tests—from the supplied evidence, or if it relies on unresolved assumptions, missing approvals, or invented details. Use the checks as release gates: revise the source inputs or assign a named, authorized reviewer instead of polishing an unsupported output.

Which AI tools have recorded tests for “Clean Excel dates and calculate a duration”?

The published test record for “Clean Excel dates and calculate a duration” lists ChatGPT as of 2026-08-28. This confirms recorded runs, not guaranteed compatibility or identical results in later product versions. For another tool or version, keep every constraint visible and repeat the result checks before use.

Mais maneiras de explorar

Onde esta receita se encaixa

Mantenha o trabalho em andamento