Query an excel table to see if a value exists
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Query an excel table to see if a value exists
working on a table with a long list of items. need to query the table to see if an item is listed without erroring out every time.
how can I check to see if "Black" is on the list and return a "N/A" or something I can use?
Any help will be appreciated. Ed.
Solved! Go to Solution.
- Labels:
-
Mechanical_Engineering
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You may use "try... on error ..." in your function SPBKUP to catch the error and return an appropriate result like NaN or a text message.
You may also consider using just lookup in your function ColNo instead of that combination of hlookup and match..
Actually I see no need for the function ColNo.
You could simply use
Of course you can replace indices 0 and 1 by ORIGIN and ORIGIN+1 to make the function ORIGIN independent.
For further help and future questions pls attach your worksheet and state which version of Prime you are using.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You may use "try... on error ..." in your function SPBKUP to catch the error and return an appropriate result like NaN or a text message.
You may also consider using just lookup in your function ColNo instead of that combination of hlookup and match..
Actually I see no need for the function ColNo.
You could simply use
Of course you can replace indices 0 and 1 by ORIGIN and ORIGIN+1 to make the function ORIGIN independent.
For further help and future questions pls attach your worksheet and state which version of Prime you are using.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Working with Prime 8. see attachment. should be moving to 10 next week.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
As Werner says, you can use the try programming operator. One possibility for a not-found value you can easily test and which has certain other advantages (and disadvantages) is the NaN, meaning Not a Number. You can use the built-in function IsNaN to check whether a value is a NaN.
Mathcad Prime 10 worksheet attached.
Stuart
Mathcad Prime 10 (and probably 8 ) Help on NaN.
NaN and undefined
•When you evaluate NaN symbolically, the result is the undefined constant.
NaN Related Function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
So I wonder why you did not try the function I posted?
It works as expected:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Werner_E wrote:
So I wonder why you did not try the function I posted?
It works as expected:
Given black is often defined as the absence of colour and any colour not in the set {Red, Blue,Green,Yellow} is absent, would "Black" be a suitable value for an absent colour?
Stuart
And people wonder why a) I spend all night awake cogitating over the whichness of the what and the whyness of the where, b) I never get invited to parties ... except by philosophers, and who wants to attend those kind of parties? Not even Professor Pettigrew doing her famous dance of the ℵα veils could entice me to such a party (at least they're countable, which is something, I suppose). Of course, if they had some decent beer, that might be another matter ... maybe if somebody could perform a Banach–Tarski operation on the beer barrel ... Hmm. I'll have to think about that one. Ah well, time for a coffee, I suppose.
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
both work for me as I have several different requirements from large tables. Thanks to both of you on this.
