Jump to content

Recommended Posts

Posted

Hi all, I'm trying to match data points for numbers that may or may not exactly be equal. In excel, I would use vlookup, TRUE for an approximate match. 

 

Simplified Example:

TABLE 1
ID Depth
1 500
2 600

 

TABLE 2

Depth X 499 20 550 30 620 40

Goal is to match closest depth and return "X".

Posted

Sorry, Table 2 didn't format correctly. Let's try this again:

TABLE 2
Depth X
499 20
550 30
620 40

 

Posted

Hi @KReed

You can solve this challenge with a simple Spotfire Python Data Function. 
Attached you can find a dxp (v14.4) where I've created this for you.

You can exchange you input tables with bigger ones. In that case please make sure that you also update the column references in the python script.
Let me know if you have any questions. 

image.thumb.png.73a638b92324d3baf8f046cd063f133f.png

image.thumb.png.bb1536899db0c8e4982dd91015ac3d6d.png

 

 

Thanks,

Alain

 

 

find_closest.dxp

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...