The paper presents a modification of the matching and difference-in-differences approach of Heckman et al. (1998) and its Stata implementation, the command flexpaneldid. The approach is particularly useful for causal analysis of treatments with varying start dates and varying treatment durations (like investment grants or other subsidy schemes). Introducing more flexibility enables the user to consider individual treatment and outcome periods for the treated observations. The flexpaneldid command for panel data implements the developed flexible difference-in-differences approach and commonly used alternatives like CEM Matching and difference-in-differences models. The novelty of this tool is an extensive data preprocessing to include time information into the matching approach and the treatment effect estimation. The core of the paper gives two comprehensive examples to explain the use of flexpaneldid and its options on the basis of a publicly accessible data set.