LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default search for a specific word and copy the word and the preceeding words until a comma

Hi Ron

Uhmm..fine! I don't have any single word to ask you for this function further.
Maybe, i, by myself, could'nt find the usage of this function by any strech of
my imagination.
Any way I thank you very much. Have a happy new year.

Regards
keizi

"Ron Rosenfeld" wrote in message
...
OK, I think I understand what you are doing.

The function can return either a horizontal or vertical array. But to do so,
you need to specify the multiple arguments in the form of an array constant
within the function.

This behavior is similar to standard Excel functions.

For example, to return a vertical array of the 1st and 2nd instances, you could
enter:

=REGEX.MID(A1,"(?<=\s|^)[\w\s]*Taluk",{1;2})

as an array formula in adjacent rows. In other words, you could select B1 &
B2; enter the formula in B1 and then hold down <ctrl<shift while hitting
<enter. Excel should copy the formula into B2, and surround both with braces
{...}.

If you have some unknown number of matches, you could replace the array
constant in the above {1;2} with the function: ROW(INDIRECT("1:n")) where n is
the maximum number of matches that might be, and then enter the formula in
multiple cells as I described above.

Furthermore, if you require a horizontal array, change the array constant to
{1,2}.

Please note that I am using the default US separators in my equations. If your
Excel version has different separators, you may also need different separators
than I used in the array constant.


Also, you could obtain these results without using an array formula. For
example, in B1 you could enter the formula:

=REGEX.MID($A$1,"(?<=\s|^)[\w\s]*Taluk",ROW())

and copy/drag down. The ROW() would give you the sequential numbers for the
different matches.

To return in a horizontal fashion, you could, in B1, use the formula:

=REGEX.MID($A$1,"(?<=\s|^)[\w\s]*Taluk",COLUMN()-1)

and copy/drag across.


--ron


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to copy the first word or two words from a cell containing a complete sentence to another cell jonny Excel Discussion (Misc queries) 7 May 19th 23 03:43 AM
Copy from Word to Excel, and retain indent, plus word wrap Eric Excel Discussion (Misc queries) 1 March 9th 07 03:15 AM
need formula to search column for a word and return another word Skyline Excel Discussion (Misc queries) 5 November 18th 05 10:00 PM
Search for specific words Newberry Excel Worksheet Functions 3 July 21st 05 10:18 PM
Macro to search a column for a specific word and replace with wendy Excel Programming 5 January 19th 04 05:41 PM


All times are GMT +1. The time now is 12:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"