+ Reply to Thread
Results 1 to 37 of 37

Iteration

Hybrid View

ajducey Iteration 10-09-2009, 01:25 AM
zbor Re: Iteration issue 10-09-2009, 01:59 AM
ajducey Re: Iteration issue 10-09-2009, 08:34 PM
teylyn Re: Iteration issue 10-09-2009, 10:41 PM
ajducey Re: Iteration issue 10-17-2009, 12:25 AM
ajducey Re: Iteration issue 10-17-2009, 12:28 AM
DonkeyOte Re: Iteration issue 10-17-2009, 02:39 AM
ajducey Re: Iteration issue 10-17-2009, 10:36 AM
DonkeyOte Re: Iteration issue 10-17-2009, 12:35 PM
martindwilson Re: Iteration issue 10-17-2009, 06:35 AM
ajducey Re: Iteration issue 10-17-2009, 11:57 PM
DonkeyOte Re: Iteration issue 10-18-2009, 03:36 AM
ajducey Re: Iteration issue 10-20-2009, 01:06 AM
DonkeyOte Re: Iteration issue 10-20-2009, 03:27 AM
ajducey Re: Iteration issue 10-26-2009, 02:27 PM
DonkeyOte Re: Iteration issue 10-26-2009, 04:56 PM
ajducey Re: Iteration issue 10-27-2009, 04:10 PM
ajducey Re: Iteration issue 10-27-2009, 03:13 PM
ajducey Re: Iteration issue 10-27-2009, 03:23 PM
ajducey Re: Iteration issue 10-27-2009, 03:32 PM
ajducey Re: Iteration issue 10-28-2009, 12:54 PM
ajducey Re: Iteration issue 10-28-2009, 12:57 PM
DonkeyOte Re: Iteration issue 10-28-2009, 12:59 PM
ajducey Re: Iteration issue 10-28-2009, 01:11 PM
DonkeyOte Re: Iteration issue 10-28-2009, 01:13 PM
ajducey Re: Iteration issue 10-28-2009, 01:16 PM
ajducey Re: Iteration issue 10-30-2009, 12:23 AM
teylyn Re: Iteration 10-30-2009, 01:47 AM
ajducey Re: Iteration 10-31-2009, 01:28 PM
ajducey Re: Iteration 11-07-2009, 11:15 PM
zbor Re: Iteration 11-08-2009, 04:03 AM
DonkeyOte Re: Iteration 11-08-2009, 08:10 AM
martindwilson Re: Iteration 11-08-2009, 08:16 AM
ajducey Re: Iteration 11-08-2009, 05:15 PM
martindwilson Re: Iteration 11-08-2009, 06:39 PM
DonkeyOte Re: Iteration issue 10-28-2009, 09:31 AM
DonkeyOte Re: Iteration issue 10-28-2009, 09:34 AM
  1. #1
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Iteration issue

    You'll struggle to come up with something truly dynamic (and elegant) in one cell without use of VBA (UDF) and/or 3rd party add-in like morefunc.xll (MCONCAT function)

    In UDF terms, the below stored in a Module

    Option Explicit
    Option Compare Text
    Function Switches(strRept As String, rngRept As Range, Optional strDelim As String) As String
    Dim lngRept As Long
    If strDelim = "" Then strDelim = ","
    For lngRept = 1 To rngRept.Value Step 1
        Switches = Switches & strDelim & Replace(strRept, "[X]", lngRept)
    Next lngRept
    Switches = Replace(Switches, strDelim, "", 1, 1)
    End Function
    in a Macro Enabled file can be used along lines of:

    B2: =SWITCHES("GigabitEthernet, [X]/0/1 - 48",$A2)
    where [X] denotes the placeholder position

    If you wanted to use an alternative delimiter (to comma) you can explicitly pass the otherwise optional 3rd argument, eg to use :

    B2: =SWITCHES("GigabitEthernet, [X]/0/1 - 48",$A2,":")

  2. #2
    Registered User
    Join Date
    10-09-2009
    Location
    Sacramento, California
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Iteration issue

    @ DonkeyOte

    That worked beautifully!! Thank you so much, really appreciated! I had another scenerio I wanted to run by you...

    Suppose I want the first and last elements in the string to be different from what's in between such as the following:

    interface range GigabitEthernet1/0/51 - 52,GigabitEthernet2/0/49 - 52,GigabitEthernet3/0/49 - 52,GigabitEthernet4/0/51 - 52

    Thanks again,

    Anne
    Last edited by shg; 10-17-2009 at 12:42 PM. Reason: Deleted spurious quote

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Iteration issue

    Not quite sure I follow... you're altering the first element in sequence (ie 1 to n) but the 2nd appears perhaps random (?) - ie how do you determine logically as to whether or not the final element should be 49/51 ? (is it only first/last should be 51 ?)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1