Populate range of alpha-numeric values given start and end points

user3285188

There is a table of three columns and ~9,400 rows listing beginning and end values for alpha-numeric ranges of codes along with a third value assigned to the ranges. It is desired to change the two columns of range endpoints into a single column of explicitly listed (1:1) values. Can you think of a method to automate explicitly listing values within the ranges?

Current example row:
|---r1----|---r2----|ccs|
| 0106T | 0110T | 7 |

Desired output:
|--code-|ccs|
| 0106T | 7 |
| 0107T | 7 |
| 0108T | 7 |
| 0109T | 7 |
| 0110T | 7 |

This is stored in a MySQL database and Excel workbook, but any language or manor of manipulation is fine.

R3uK

If it is only with a "T" this will work and is a good base to your full macro :

Sub Alpha()
Dim WsS As Worksheet
Set WsS = Worksheets("Source")
Dim WsR As Worksheet
Set WsR = DeleteAndAddSheet("Results")

For i = 2 To WsS.Range("A" & Rows.Count).End(xlUp).Row

    For k = Val(WsS.Cells(i, 1)) To Val(WsS.Cells(i, 2))
        WsR.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0) = k & "T " & WsS.Cells(i, 3)
    Next k

Next i

End Sub

Useful function for Sheets :

Public Function DeleteAndAddSheet(ByVal SheetName As String) As Worksheet

For Each aShe In Sheets
    If aShe.Name <> SheetName Then
    Else
        Application.DisplayAlerts = False
        aShe.Delete
        Application.DisplayAlerts = True
        Exit For
    End If
Next aShe

Sheets.Add after:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = SheetName

Set DeleteAndAddSheet = ThisWorkbook.Worksheets(Worksheets.Count)

End Function

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

range variable not detecting floating points numeric values inside the given range

Split numeric values into given range

Changing the values on the path between two points in the matrix given the start and end coordinates

How to rename `start` and `end` range values with serde?

How to calculate 'start' & 'end' angle of an Arc by given 2 points?

R How to Generate Sequences in a Tibble Given Start and End Points

Finding a way between points given start and end coordinates in the matrix in C

Setting start and end dates by quarter given a date range

extracting specific values between given start and end values R

Rxjs Observable array select between given start and end values

SQL (Redshift) get start and end values for consecutive data in a given column

Groupby range of numbers in Pandas and extract start and end values

How to regex - get alpha from beginning OR end of alpha string (and numeric)

Determine a numeric range that may contain alpha and numeric characters

Copy an Alpha numeric number down with numeric number Range

Sorting numeric values mixed with alpha numeric values in mysql

Sort varchar with alpha numeric and special character values

Python - How to sort a list of alpha and numeric values?

Alpha Numeric values xcannot be retrieved in PHP

How do I get generate an IP address range given start and end IP address?

How to calculate how many start-end pairs run in a given range of time-of-day

Generate week start date, week end date, month week no by using the given date range in javascript

MySQL: Count days within a given range excluding weekends, include start and end if they are weekdays

How can I create range of date given the start date and end date

Construct a df such that every number within a range gets value 'A' assigned when knowing the start and end of the range values that belong to 'A'

Cannot convert alpha-numeric values in a dataset to just numeric

using regexp to find space separated numeric and alpha numeric values in tcl

Filter by numeric column start with a given number

Rust range where start > end

TOP Ranking

HotTag

Archive