Consulting

Results 1 to 3 of 3

Thread: Solved: Creating a dynamic concatenation from a list

  1. #1
    VBAX Regular
    Joined
    Sep 2012
    Posts
    17
    Location

    Solved: Creating a dynamic concatenation from a list

    I have a spreadsheet which has list of companies with each company given a ranking.

    Also I have a clock timer which shows what minute it is.

    My aim is to try and display the top ranking company names separated by a comma in a cell based on what the current minute (cell E6) is up to i.e. On the 3rd minute display the text "AOL, Apple, Air Pacific" in a cell as these three companies are ranked 1st, 2nd and 3rd.

    On the fourth minute in the cell it would then display the text "AOL, Apple, Air Pacific, BMW" as BMW ranks 4th on the list.

    See Attached Spreadsheet.

    Is there a way to do this without having to use a long if statement?

    Cheers
    Attached Files Attached Files

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    As before, np formula use the timer

    [VBA]Sub SetTimer()
    Dim clock As Date
    Dim i As Long
    If datStartTime = 0 Then datStartTime = Now
    clock = Now - datStartTime
    If Second(clock) = 0 Then
    If Minute(clock) = 0 Then
    Range("D18").Value = Range("B2")
    Else
    Range("D18").Value = Range("D18").Value & "," & Cells(Minute(clock) + 2, "B").Value
    End If
    End If
    SchedRecalc = Now + TimeValue("00:00:01")
    Application.OnTime SchedRecalc, "RecalcTimer"
    End Sub
    [/VBA]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Sep 2012
    Posts
    17
    Location
    Excellent!

Posting Permissions

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