To calculate cross correlation, you first need two time series datasets. The cross correlation function (CCF) is then used to determine the correlation between these two datasets at different time lags. The formula involves computing the covariance and normalizing it by the standard deviations of the datasets. Various statistical software and programming languages, such as R and Python, offer built-in functions for this calculation.