A search for vectorlike leptons in multilepton final states is presented. The data sample corresponds to an integrated luminosity of 77.4 fb(-1) of proton-proton collisions at a center-of-mass energy of 13 TeV collected by the CMS experiment at the LHC in 2016 and 2017. Events are categorized by the multiplicity of electrons, muons, and hadronically decaying tau leptons. The missing transverse momentum and the scalar sum of the lepton transverse momenta are used to distinguish the signal from background. The observed results are consistent with the expectations from the standard model hypothesis. The existence of a vectorlike lepton doublet, coupling to the third-generation standard model leptons in the mass range of 120-790 GeV, is excluded at 95% confidence level. These are the most stringent limits yet on the production of a vectorlike lepton doublet, coupling to the third-generation standard model leptons.