ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need a way to verify a string is present in 1-column array? (https://www.excelbanter.com/excel-programming/439133-need-way-verify-string-present-1-column-array.html)

tan

Need a way to verify a string is present in 1-column array?
 
I need to verify than an operator string (part number) input is valid from a
predetermined listing of "acceptable" part numbers without getting #N/A
error. Help!

Dave Peterson

Need a way to verify a string is present in 1-column array?
 
Maybe you can use application.match()

Dim res as variant 'could be an error
dim myArr as variant
dim myVal as variant 'could be a number or string

myarr = array(1, 2, "abc", "def")

myval = "abc"
res = application.match(myval,myarr,0)

if iserror(res) then
'not found
else
'was found
end if



TAN wrote:

I need to verify than an operator string (part number) input is valid from a
predetermined listing of "acceptable" part numbers without getting #N/A
error. Help!


--

Dave Peterson


All times are GMT +1. The time now is 06:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com