A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Copy the following code into a module in the Visual Basic Editor:
Function ListZips(s As String) As String
Const strSeparator = ","
Dim arrParts() As String
Dim arrLimits() As String
Dim i As Long
Dim j As Long
Dim strReturn As String
arrParts = Split(s, ",")
For i = 0 To UBound(arrParts)
arrLimits = Split(Trim(arrParts(i)), "-")
Select Case UBound(arrLimits)
Case 0
' Only one number
strReturn = strReturn & strSeparator & arrLimits(0)
Case 1
' Two numbers
For j = Val(Trim(arrLimits(0))) To Val(Trim(arrLimits(1)))
strReturn = strReturn & strSeparator & j
Next j
Case Else
' This should not occur
End Select
Next i
If strReturn <> "" Then
strReturn = Mid(strReturn, Len(strSeparator) + 1)
End If
ListZips = strReturn
End Function
Let's say you have a string such as 600-617 in cell A2.
In B2, enter the formula =ListZips(A2)
This formula can be filled down.