Suav hnub, hli, xyoo nrog DATEDIF muaj nuj nqi hauv Excel

Cov txheej txheem:

Suav hnub, hli, xyoo nrog DATEDIF muaj nuj nqi hauv Excel
Suav hnub, hli, xyoo nrog DATEDIF muaj nuj nqi hauv Excel
Anonim

The DATEDIF muaj nuj nqi suav lub sijhawm lossis qhov txawv ntawm ob hnub hauv hnub, hli, thiab xyoo. Koj tuaj yeem siv DATEDIFua haujlwm los txiav txim siab lub sijhawm rau qhov project yuav los tom ntej, lossis nws tuaj yeem siv, nrog rau tus neeg hnub yug, los xam tus neeg lub hnub nyoog hauv xyoo, hli, thiab hnub, piv txwv li.

Cov lus qhia no siv rau Excel 2019, 2016, 2013, 2010, thiab Excel rau Microsoft 365.

DATEDIF Muaj nuj nqi Syntax thiab lus sib cav

A muaj nuj nqi syntax hais txog kev teeb tsa ntawm txoj haujlwm thiab suav nrog cov haujlwm lub npe, cov hlua khi, thiab cov lus sib cav. Cov syntax rau DATEDIF muaj nuj nqi yog:

=DATEDIF(start_date, end_date, "unit")

  • start_date (yuav tsum tau): Koj tuaj yeem sau hnub pib ntawm lub sijhawm xaiv lossis lub xov tooj ntawm tes siv rau qhov chaw ntawm cov ntaub ntawv no hauv daim ntawv ua haujlwm.
  • end_date (yuav tsum tau): Raws li hnub pib, koj tuaj yeem nkag mus rau hnub kawg ntawm lub sijhawm xaiv lossis kev siv ntawm tes.
  • unit (yuav tsum tau): Chav tsev qhia cov haujlwm kom pom cov hnub ("D"), ua tiav lub hlis ("M"), lossis ua tiav xyoo (" Y") nruab nrab ntawm ob hnub. Koj yuav tsum nyob ib puag ncig ntawm chav tsev sib cav nrog cov lus hais xws li "D" lossis "M."

Ntxiv rau D, M, thiab Y, muaj peb lwm chav xaiv uas koj tuaj yeem pom hauv daim duab hauv qab no:

  • "YD" suav cov hnub ntawm ob hnub, tab sis tsis quav ntsej lub xyoo (kab 5).
  • "YM" suav cov hli ntawm ob hnub, tab sis tsis quav ntsej hnub thiab lub xyoo (kab 6).
  • "MD" suav cov hnub ntawm ob hnub, tab sis tsis quav ntsej lub hli thiab xyoo (kab 7).
Image
Image

DATEDIF yog lub luag haujlwm zais yog li koj yuav tsis pom nws teev nrog lwm cov haujlwm hnub hauv qab Formula tab hauv Excel, uas txhais tau tias koj tsis tuaj yeem siv Function Dialog Box nkag mus rau nws. Yog li ntawd, koj yuav tsum nkag mus rau qhov muaj nuj nqi thiab nws cov lus sib cav manually rau hauv lub xov tooj.

Excel suav hnub suav hnub los ntawm kev hloov cov hnub rau cov lej lej. Lub Kaum Ob Hlis 31, 1899, yog tus lej 1 thiab Lub Ib Hlis 1, 2008, yog tus lej 39488 vim nws yog 39, 488 hnub tom qab Lub Ib Hlis 1, 1900.

Xaiv qhov txawv ntawm Hnub Nrog DATEDIF

Ntawm no yog yuav ua li cas nkag rau DATEDIF muaj nuj nqi nyob hauv cell B2, raws li pom hauv cov duab piv txwv saum toj no, kom pom cov naj npawb ntawm hnub nruab nrab ntawm hnub tim May 4, 2014, thiab Lub Yim Hli 10, 2016.

=DATEDIF(A2, A3, "D")

Hauv qab no yog cov kauj ruam los sau cov haujlwm no siv cov ntaub ntawv xovtooj.

Image
Image
  1. Click cell B2 ua kom nws lub cev muaj zog; qhov no yog qhov uas cov hnub ntawm ob hnub yuav tshwm sim.
  2. In cell B2, hom =datedif(.
  3. Click cell A2 txhawm rau nkag mus rau lub xov tooj no siv raws li start_date sib cav rau txoj haujlwm.
  4. Type a comma (,) hauv cell B2 ua raws li kev siv ntawm tesA2 los ua tus sib cais ntawm thawj thiab thib ob sib cav.

  5. Click cell A3 txhawm rau nkag mus rau lub xov tooj no siv raws li end_date sib cav.
  6. Type a comma (,) tom qab tus xov tooj siv A3.
  7. Rau qhov unit sib cav, ntaus ntawv D hauv nqe lus ("D") qhia cov haujlwm kom pom cov hnub ntawm ob hnub.
  8. Type a kaw parenthesis.
  9. Nias lub Enter tus yuam sij ntawm cov keyboard kom tiav cov qauv.
  10. Tus lej hnub - 829 - tshwm hauv cell B2 ntawm daim ntawv ua haujlwm.
  11. Thaum koj nyem rau cell B2, cov qauv ua tiav tshwm nyob rau hauv daim ntawv qhia zaub mov saum toj ntawm daim ntawv ua haujlwm.

DATEDIF yuam kev Values

Yog tias koj tsis nkag mus rau cov ntaub ntawv rau cov lus sib cav hauv cov haujlwm no kom raug, cov txiaj ntsig yuam kev hauv qab no tshwm sim:

  • VALUE!: Koj yuav tau txais qhov yuam kev no yog tias qhov pib_date lossis hnub kawg tsis yog hnub tseeb (kab 8 hauv daim duab hauv qab no, qhov twg cell A8 muaj cov ntaub ntawv ntawv).
  • NUM!: Koj yuav pom qhov no yog tias hnub kawg yog hnub ua ntej tshaj hnub pib (kab 9 hauv qab).

Pom zoo: