I am new to coding and trying to learn through VBA. What I am trying to do is calculate outliers in a data set following a procedure. My trouble is trying to identify the elements in the Data Set that are furthest from the mean (the outlier) and looping that k times. Most of the code is very messy as I have been trying to find out what is wrong so ignore the MsgBox's and ugly formatting. In the last part of my code I tried taking the elements from DataSet and subtracting them from the mean and storing those values in a new array. After that I would take absolute value of the elements in the Diff array and store them in a new array (Diff2). I know I could bypass Diff2 by just taking the absolute value of the calculation of Diff. When I run the code I get the type mismatch error and after some investigation i realized that Diff (and Diff2) are not arrays. If anyone knows of how I can make Diff an array or of a better workaround for this that would be much appreciated!I am new to coding and trying to learn through