Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I've tried using the Nth_Occurence function (below) from the Ozgrid site. The problem is when I set it up for 1,2,3,4,5 occurences and if there is only one occurence it shows that one in all 5 cells. Could a slight change in this code return a blank if looking for a 2nd occurnace and there is no 2nd? Thanks in advance, Tom Function Nth_Occurrence(range_look As Range, find_it As String, _ occurrence As Long, offset_row As Long, offset_col As Long) Dim lCount As Long Dim rFound As Range Set rFound = range_look.Cells(1, 1) For lCount = 1 To occurrence Set rFound = range_look.Find(find_it, rFound, xlValues, xlWhole) Next lCount Nth_Occurrence = rFound.offset(offset_row, offset_col) End Function -- tomandrobyn ------------------------------------------------------------------------ tomandrobyn's Profile: http://www.excelforum.com/member.php...o&userid=13879 View this thread: http://www.excelforum.com/showthread...hreadid=488265 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
help text for user defined formula | Excel Worksheet Functions | |||
Formula as User Defined Function | Excel Programming | |||
User-defined data type; Error: Only User-defined types... | Excel Programming | |||
external range in VBA (user defined formula) | Excel Programming | |||
external range in VBA (user defined formula) | Excel Programming |