![]() |
Search an array
Assume an array of string type, and a string varible. Is
there a function or shortcut way of identifying the index number of the first element whose value matches the value of the variable? |
Search an array
One way is Excel's Match function:
Application.Match(lookup_val, arr(), 0) returns either the index position of the value found in the list, or an error if not found, so use a variant and trap the error using IsError. " wrote in message ... Assume an array of string type, and a string varible. Is there a function or shortcut way of identifying the index number of the first element whose value matches the value of the variable? |
Tim - perfect - thanks (eom)
-----Original Message----- One way is Excel's Match function: Application.Match(lookup_val, arr(), 0) returns either the index position of the value found in the list, or an error if not found, so use a variant and trap the error using IsError. " wrote in message ... Assume an array of string type, and a string varible. Is there a function or shortcut way of identifying the index number of the first element whose value matches the value of the variable? . |
Search an array
Application.Match is 1-based, so you will need to adjust for 0-based
arrays (or, for that matter, for an n-based array where n is not 1). Alan Beban Tim Zych wrote: One way is Excel's Match function: Application.Match(lookup_val, arr(), 0) returns either the index position of the value found in the list, or an error if not found, so use a variant and trap the error using IsError. " wrote in message ... Assume an array of string type, and a string varible. Is there a function or shortcut way of identifying the index number of the first element whose value matches the value of the variable? |
All times are GMT +1. The time now is 05:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com