I notice that the interpolation grid represented by the two tables is a bit irregular (the x and y columns are not consistently spaced), which, I know can impact the choice of the interpolation algorithm (though I do not have the expertise to know exactly how in all cases).
Yes, and Table 2 actually has a lot more 'ExtPressTables' types (CS-1, CS-2, HA-1, etc...) where some of the 'ExtPressTemp' fields start at less than 300 (i.e. 100, or 200), but the way it's set up in the 'Sample1' workbook gives me what I want (comparing it to samples I'm working off)
I'd like do do it in VBA
Essentially Code to do 'A', which is currently:
=LET(d,O12,l,O13,do,DOT,ld,LDo,dlh,XLOOKUP(d,do,do,,{-1,1}),
elh,BYCOL(dlh,LAMBDA(ll,TREND(XLOOKUP(l,ld/(do=ll),ExtA,,{-1;1}),XLOOKUP(l,ld/(do=ll),ld,,{-1;1}),l))),
TREND(elh,dlh,d))
and code to do 'B', which is currently:
=LET(t,F3,c,F6,ex,O14,eta,ExtPressTables,ete,ExtPressTemp,ea,ExtPressA,eb,ExtPressB,tlh,XLOOKUP(t,ete/(eta=c),ete,,{-1,1}),
eblh,BYCOL(tlh,LAMBDA(tt,LET(x,ea/(eta=c)/(ete=tt),TREND(XLOOKUP(ex,x,eb,,{-1;1}),XLOOKUP(ex,x,ea,,{-1;1}),O14)))),
TREND(eblh,tlh,t))
Ideally, instead of using named column ranges, I'd like to be able to just reference just the table, the variables and what I'm looking for because I want to be able to use it on different table, depending on if it uses 1, 2 or 3 columns to find variables in.
I would have something like: @Int2D(Table1,O12,O13,ExtA) where the 'Int2D' is in place of the current function InterpVol, and is using two columns to find and interpolate the 'ExtA' column of Table1. And @Int3D(Table2,F3,F6,O14,ExtPressB) to find the 'B' value from Table2
If it was a formula, this is how it would be based off of the above potential UDF callout @Int2D. Notice that I don't callout for ExtPressA, ExtPressB, or ExtPressTemp, I just grab the column numbers from the table.
=LET(d,O12,l,O13,do,INDEX(Table1,,1),ld,INDEX(Table1,,2),dlh,XLOOKUP(d,do,do,,{-1,1}),
elh,BYCOL(dlh,LAMBDA(ll,TREND(XLOOKUP(l,ld/(do=ll),INDEX(Table1,,MATCH("ExtA",INDEX(Table1,1,0),0)),,{-1;1}),XLOOKUP(l,ld/(do=ll),ld,,{-1;1}),l))),
TREND(elh,dlh,d))
I realize I suck at explaining things, good thing I'm not a teacher, but I hope it is clearer.
Bookmarks