GetValueIndexByPosition
GetValueIndexByPosition ( valueList , valueString , matchCase , occurrence , positionLCR )
GetValueIndexByPosition retrieves the index of the value in a value list whose left, center or right portion matches the value string search text. Returns 0 if not found. Toggle case-sensitive searching by passing a boolean through matchCase. Search for specific valueString occurrence – a negative occurrence number causes backward search from the end of the valueList. Specify whether to match the valueString from the Left, Center (middle), or Right within the value.
Parameters
- valueList – Value list to search.
- valueString – Text to search for in valueList.
- matchCase – Require search to find exact case-sensitive match only.
- occurrence – Specify which instance of the valueString in valueList to search for and retrieve. A negative number cause a backward search from end of valueList.
- positionLCR – Specify where in each value to search for the valueString text: left side, center, or right side.
Examples
- GetValueIndexByPosition ( “Alpha¶Bravo¶Charlie¶Echo”, “charl”, False, 1, “L” ) = 3
- GetValueIndexByPosition ( “Alpha¶Bravo¶Charlie¶Echo”, “charlie”, True, 1, “L” ) = 0
- GetValueIndexByPosition ( “Daniel¶Danny¶Bill¶daniel¶Frank¶daniel¶Ed”, “aniel”, True, -2, “R” ) = 4
- GetValueIndexByPosition ( “Daniel¶Danny¶Bill¶daniel¶Frank¶daniel¶Ed”, “an”, False, -2, “C” ) = 5
NOTICE: This function is a recursive function. If you change the name of it, then change the name references inside the code.
GetValueIndexByPOsition code: Copy the selected code (click on Select All to highlight all the code) to the clipboard and paste it into a newly created Custom Function. Download the code in a text file from here.
Comments
GetValueIndexByPosition — No Comments
HTML tags allowed in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>