Extrapolate Values between 2 Rows

TheTiredEngineer

New Member
Joined
Jul 31, 2024
Messages
31
Office Version
  1. 365
Platform
  1. Windows
I have this table of data:

pH
Temp
6​
78
9​
10
0.5​
12​
12​
12​
12​
90​
5​
8​
8​
8​
8​
60​
10​
6​
6​
6​
6​
45​
15​
4​
4​
4​
4​
30​
20​
3​
3​
3​
3​
22​
25​
2​
2​
2​
2​
15​

And Im trying to get a formula that can extrapolate pH values for between two rows. So say my temperature is 12C, it doesnt fit exactly into one of the rows, so it needs to extrapolate based on the values in this table already. I figure that I have to do a Match to find the pH column that I need (though thats not working either), I just need help with the extrapolation.

Excel Formula:
=Match(pH,A1:A5)
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
1) make sure your numbers are numbers, not textx, which just look like numbers.
I suspect some of them are texts, as they are lest justified. Like 7, 8 and 10.

2) as for problem definition/descriptiom: You have 2 values: pH and temperature and would like to read a value from the table (with possible interpolation between 2 rows if temperature is not exactly 0.5, 5, 10 ...).

So for exact case, like pH=7 and T=15 the result is 4,
and you would like for pH=7 and T=12.5 the result 5

Is that right?
 
Upvote 0
I used your data to create a scatter chart for the data with x=temp and y=values below the pH, and then added an exponential trendline (pH 6 to pH9 are the same as each other, and pH 10 has a different equation). I pulled the slope equation from the chart and got the following:
1724946543024.png
1724946554132.png

2024-08-29.xlsx
CDEFGHI
4Temp/pH678910
50.51212121290
65888860
710666645
815444430
920333322
1025222215
11y = 12.016e-0.071xy = 90.229e-0.072x
12
13Calculatefor pH 6-9for pH 10
14input x (temp)calc ycalc y
150.511.687.0
16111.284.0
17210.478.1
1839.772.7
1949.067.7
2058.463.0
2167.858.6
22105.943.9
23125.138.0
24154.130.6
25183.324.7
26202.921.4
27252.014.9
Sheet1
Cell Formulas
RangeFormula
D15:D27D15=12.016*EXP(-0.071*$C15)
E15:E27E15=90.229*EXP(-0.072*$C15 )
 
Upvote 0
Well, the exponential trendline seems to be a good idea. But you will not get exactly the same values for data already in table.

So as I prepared linear interpolation method, I'll present it below:

After I copied data from your post indeed some of "numbers" were texts. You can easily check it out by changing format to numbers with 1 decimal digit. Numbers will follow this formatting, while texts will remain unchanged (with no decimal digit).

Proposition of formula for a location of a table as shown on a screenshot, and using linear interpolation:
Excel Formula:
=LET(mycol,MATCH(I1,B1:F1,0),myrow,MATCH(I2,A$2:A$7,1),ltemp,INDEX(A2:A7,myrow),utemp,INDEX(A2:A7,myrow+1),((utemp-I2)*INDEX(B2:F7,myrow,mycol)+(I2-ltemp)*INDEX(B2:F7,myrow+1,mycol))/(utemp-ltemp))
Or the same formula written in a structured way:
Excel Formula:
=LET(
  mycol, MATCH(I1,B1:F1,0),
  myrow, MATCH(I2,A$2:A$7,1),
  ltemp,  INDEX(A2:A7,myrow),
  utemp, INDEX(A2:A7,myrow+1),
  ((utemp-I2)*INDEX(B2:F7,myrow,mycol)+(I2-ltemp)*INDEX(B2:F7,myrow+1,mycol))/(utemp-ltemp)
)

Of course instead of LET formula you can calculate helper values in extra cells and then refer to them in final formula.
 

Attachments

  • Zrzut ekranu 2024-08-29 175535.png
    Zrzut ekranu 2024-08-29 175535.png
    47.3 KB · Views: 1
Upvote 0
Solution
I'll take a stab at this tomorrow. I got so overwhelmed with this rabbit hole today that I put it aside for the day.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top