Hi, this is my first post on the forum. I have tried to simplify my problem with the attached picture.
In the first worksheet [Data] I have the collected raw data. In the second worksheet [Results], I need to calculate both the average and standard deviation of this data.
ExcelForum1.png
I need to calculate the StDev of the lat/long/vert data for each individual ID [col A] and have inserted an "ID by row" [Data, col B] to avoid a merged cell crisis with the formula.
This formula [in theory] looks to find the StDev of the values whose ID in Results [col A] matches with the "ID by row" [col B] on the Data sheet - the idea being the StDev will be calculated based on every value in the rows with the same identifier:
L3 - Lat: {=IFERROR(STDEV(IF(Data!$B$2:$B$26=Results!$A3,Data!$E$2:$E$26,"")),"")}
M3 - Long: {=IFERROR(STDEV(IF(Data!$B$2:$B$26=Results!$A3,Data!$F$2:$F$26,"")),"")}
N3 - Vert: {=IFERROR(STDEV(IF(Data!$B$2:$B$26=Results!$A3,Data!$G$2:$G$26,"")),"")}
This works for the first row only [ID 1], however when I copy the formula down [=Results!$A4 and on...] the answers generated are incorrect and do not match. [Eg: ID 3 only has one value in the lat/long/vert, so the StDev of one value should return a #Div/0!, or blank after I use the IFERROR, but =Results!$A5 returns 0.107 for lat and 0.027 for long]. If the array doesn't copy down, the values returned are the StDev for all values in the respective data column, which is not what I am after.
I can achieve the correct answers by manually selecting every range [Results H3: =IFERROR(STDEV(Data!E2:E6),"") and H4: =IFERROR(STDEV(Data!E7:E11),"") and so on] but I don't want to have to do this hundreds of times for each individual ID as it is a very large data set and continues to grow on a daily basis.
Can anyone help me find out where I've gone wrong, or if what I'm trying to achieve is even possible? I suspect it's to do with the ID's not correctly being matched in the IF formula but I can't find another way of doing this online that gets me remotely close to these answers.
I am using Excel 2007.
Thanks in advance for any assistance.
Bookmarks