As the title states, that's what I am trying to do. I originally was following the solution to another post that was asking about the same question and this worked, until I started having data that had repeating x-values (But still different y-values). See below:
The red line is the correct fit applied by Excel, while the green, dotted line is the custom fit I apply. I am using the Excel fit to check against my own. So as can be seen, my fit is wildly off. The only thing I can see why this is happening is because of the repeating x-values. If this is the case, why does this matter mathematically? Because, from what I see from the formulas from the other post I was following, it shouldn't matter. The site is not allowing me to attach the Excel file, so here is the data and functions:
b == (SUM(H7:H12)-(1/3)*SUM(D7:D12)*SUM(G7:G12))/(SUM(I7:I12)-(1/3)*SUM(D7:D12)^2)
a == (1/3)*SUM(G7:G12)-(1/3)K6SUM(D7:D12)