List IP's in a list of ranges

Danny54

Active Member
Joined
Jul 3, 2019
Messages
295
Office Version
  1. 365
Platform
  1. Windows
Does anyone know how to go about generating a list of ip's in list of ranges or seen it done using a macro?

Thanks

input sheet

test210.10.3.0-10.10.3.9, 10.10.3.11, 10.10.3.15-10.10.3.16
test3199.10.3.0-199.10.3.9, 199.10.3.11, 199.10.3.15-199.10.3.16

desired output sheet

10.10.3.0
10.10.3.1
10.10.3.2
10.10.3.3
10.10.3.4
10.10.3.5
10.10.3.6
10.10.3.7
10.10.3.8
10.10.3.9
10.10.3.11
10.10.3.15
10.10.3.16
199.10.3.0
199.10.3.1
199.10.3.2
199.10.3.3
199.10.3.4
199.10.3.5
199.10.3.6
199.10.3.7
199.10.3.8
199.10.3.9
199.10.3.11
199.10.3.15
199.10.3.16
 
now should be ok
IPs
10.10.3.0
10.10.3.1
10.10.3.2
10.10.3.3
10.10.3.4
10.10.3.5
10.10.3.6
10.10.3.7
10.10.3.8
10.10.3.9
10.10.3.11
10.10.3.15
10.10.3.16
199.10.3.0
199.10.3.1
199.10.3.2
199.10.3.3
199.10.3.4
199.10.3.5
199.10.3.6
199.10.3.7
199.10.3.8
199.10.3.9
199.10.3.11
199.10.3.15
199.10.3.16
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I forgot about M
Rich (BB code):
let
    Source = Excel.CurrentWorkbook(){[Name="Table7"]}[Content],
    Split1 = Table.ExpandListColumn(Table.TransformColumns(Source, {{"raw", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "raw"),
    Split2 = Table.SplitColumn(Table.TransformColumns(Split1,{{"raw", Text.Trim, type text}}), "raw", Splitter.SplitTextByAnyDelimiter({"-"}, QuoteStyle.Csv)),
    List = Table.AddColumn(Table.AddColumn(Table.AddColumn(Table.AddColumn(Split2, "raw.3", each if [raw.2] = null then [raw.1] else [raw.2]), "LC1", each Text.End([raw.1], 1), type text), "LC2", each Text.End([raw.3], 1), type text), "List", each {[LC1]..[LC2]}),
    Len = Table.TransformColumns(Table.AddColumn(Table.ExpandListColumn(List, "List"), "Length", each Text.Length([raw.1]), Int64.Type), {{"Length", each _ - 1, type number}}),
    TSC = Table.SelectColumns(Table.CombineColumns(Table.AddColumn(Len, "First Characters", each Text.Start([raw.1], [Length]), type text),{"First Characters", "List"},Combiner.CombineTextByDelimiter("", QuoteStyle.None),"IPs"),{"IPs"})
in
    TSC
? :biggrin: :cool::ROFLMAO::sneaky::cool:
and now :coffee:
 
Upvote 0
Thanks guys. (Dante your solution worked - Super Job)

Im intrigued with the power query solution mentioned. I haven't coded anything in that arena.

Just to explain - I have a cell containing server ranges of IP's. they might all be in sequence or they might jump ranges.

example

10.0.0.0 - 10.0.0.2 would list only 3 ip's (10.0.0.0, 10.0.0.1, 10.0.0.2)

or

10.0.0.0 - 10.0.0.2, 10.0.0.5, 10.0.0.10-10.0.0.12 would list 7 ip's (10.0.0.0, 10.0.0.1, 10.0.0.2, 10.0.0.5, 10.0.0.10, 10.0.0.11, 10.0.0.12)

of course the decoded list would start on sheet2 - all in column "A1" going down the page in column "A"

Guys,
thanks so much for the help.

Have a great day!
 
Upvote 0
To learn more about Power Query, I urge you to obtain the book "M is for (Data) Monkey" on Amazon by Ken Puls and Miguel Escobar. It allows you to Mash up any worksheet.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top