One table for your A and B values, a second table for the summary values using the SuMif, Countif and AverageIf functions.
Then in the values table add a third column calculating the deviation of the B value from the average B value using a vlookup on A to the summary table.
In the values table add a fourth column calculating the square of the deviation.
In the summary table add a column summing the new squares of the deviation col using sumif.
In the summary table add column dividing the sum of the squares by either the countif total (for a population StDev) or the countif -1 for a sample stdev.
In the summary table add a column taking the square root of the previous mean squares column to give the std dev.
Cross your fingers that you don’t have a circular reference then plot your graph.