I am working on a project and told to remove all outliers by using the u +- 3s approach
Of course, you should do what you are told to do. But unless your data is (expected to be) normally distributed, identifying outliers by +/-sd might not be the right thing to do.
More generally, I prefer to use the IQR method. But I choose +/-1.7IQR in order to approximate +/-3sd for normal distributions.
do i need to calculate the mean and all quartiles to remove the outliers or is there a single excel function that can remove the data outside 3 standard deviations?
Ironically, you do not need to calculate "all quartiles". That would be for the IQR method (and only the 25%ile and 75%ile, and not the mean).
But you do need to calculate the mean (AVERAGE) and standard deviation (STDEVP or STDEV.P) for the +/-3sd method.
Although you could "remove" outliers, it might be sufficient to
ignore them in your calculations.
For example, if U1 is =AVERAGE(A1:A1000) and S1 is =STDEVP(A1:A1000), where A1:A1000 is all of your data, the mean and standard deviation of the data "without" (ignoring) outliers are the following
array-entered formulas (press
ctrl+shift+Enter instead of just Enter):
=AVERAGE(IF(ABS(STANDARDIZE(A1:A1000,U1,S1))<=3, A1:A1000))
=STDEVP(IF(ABS(STANDARDIZE(A1:A1000,U1,S1))<=3, A1:A1000))
You might choose to use STDEV instead of STDEVP in the last formula.
PS.... Again, you should do whatever you are told to do. But in actual practice, most statisticians suggest that outliers should be
identified, but only removed or ignored after determining that they represent
errors in the data, not merely extremes.