• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Linear Interpolation (2 input, 1 output)

Peter Bartholomew

Well-Known Member
Code:
= LET(
  selectedPressureCase, XLOOKUP(@PressureCase, Data[#Headers], Data ),
  temperatureBand,      XLOOKUP(@Temperature, Data[Temperature], Data[Temperature], ,{-1,1}),
  pressureBand,         XLOOKUP(@Temperature, Data[Temperature], selectedPressureCase, ,{-1,1}),
  interpolatedPressure, TREND( pressureBand, temperatureBand, @Temperature ),
  interpolatedPressure )
This applies to recent versions of Microsoft365
 

Attachments

Please try
Shorter but volatile
=TREND(OFFSET($B$2,MATCH(G3,$B$3:$B$8),MATCH(H3,$C$2:$E$2,),2),OFFSET($B$2,MATCH(G3,$B$3:$B$8),,2),G3)
or Non volatile
=TREND(INDEX(LARGE(INDEX($C$3:$E$8,,MATCH(H3,$C$2:$E$2,)),MATCH(G3,$B$3:$B$8)+{0;1}),),INDEX(SMALL($B$3:$B$8,MATCH(G3,$B$3:$B$8)+{0;1}),),G3)
 

Attachments

XOR LX

Active Member
A shorter alternative for the non-volatile option:

=TREND(LARGE(IF(C$2:E$2=H3,C$3:E$8),MATCH(G3,B$3:B$8)+{0,1}),INDEX(B$3:B$8,N(IF(1,MATCH(G3,B$3:B$8)+{0,1}))),G3)

Regards
 

Peter Bartholomew

Well-Known Member
@XOR LX
By the time I had managed to 'simplify' the formula to something I understood, it looked like
Code:
= TREND(
    LARGE(IF(Data[#Headers]=@PressureCase,Data), MATCH(@Temperature,Data[Temperature])+{0,1}),
    INDEX(Data[Temperature], N(IF(1,MATCH(@Temperature, Data[Temperature])+{0,1}))),
    @Temperature)
which I suppose would cause as much alarm and despondency amongst 'real' spreadsheeters as my original :(

Out of curiosity why was the coercion needed?
Code:
= TREND(
    LARGE(IF(Data[#Headers]=@PressureCase,Data), MATCH(@Temperature,Data[Temperature])+{0,1}),
    INDEX(Data[Temperature], MATCH(@Temperature, Data[Temperature])+{0,1}),
    @Temperature)
works as well for me.
 

Peter Bartholomew

Well-Known Member
Fair enough; I am clearly rapidly forgetting the way things used to be! Even worse, it is so many years since I have used direct cell referencing, that I now approach it as a cipher decryption challenge rather than recognising 'normal' code.
 

ahtze

New Member
There is one issue, when I put the temperature to the MAX (600) in this case, it returns error.
 

XOR LX

Active Member
One option:

=AGGREGATE(16,6,LARGE(IF(C$2:E$2=H3,C$3:E$8),MATCH(G3,B$3:B$8)+{0,1}),1-MOD(G3,100)/100)

Regards
 
Top