1001Ferramentas
πŸ”’ Utilities

Number Range Expander & Compactor

Expands compact lists like 1,3,5-9 into individual numbers and compacts long lists back into ranges, reporting gaps, duplicates and totals.

Separate with commas, semicolons, spaces or line breaks β€” mixed is fine. Ranges also accept .. and an en dash.

Where this shows up

Print dialogs, scanners and ticketing systems all speak the compact form 1,3,5-9. Databases and spreadsheets want one value per row. Going from one to the other by hand is where numbers get skipped, and a skipped invoice number is the kind of thing an audit finds before you do.

The gap list is the part worth reading: it takes the smallest and largest values you pasted and reports every number missing in between, already compacted. Paste the invoice numbers you actually issued and the holes in the sequence show up on their own.

Compact ranges and long lists, both directions

The print dialog takes 1,3,5-9. The database wants one value per row to feed a WHERE IN clause. The ticketing system shows the compact range while the checking sheet shows the open list. Translating between the two by hand is where numbers quietly go missing, and a missing invoice number tends to surface in an audit before it surfaces for you. This converts both ways, with matching results.

Expanding turns 5-9 into 5, 6, 7, 8 and 9, and loose numbers pass through untouched. Compacting reads the whole list, sorts it and folds runs back into ranges. The step applies to both sides: with a step of 2, expanding 1-9 gives 1, 3, 5, 7, 9, and compacting that same list returns 1-9. Commas, semicolons, spaces and line breaks can be mixed in the input, and the range marker accepts a hyphen, .. or an en dash.

The part worth reading is the gap list. It takes the smallest and largest value you pasted and reports every number missing in between, already compacted: paste the invoices you actually issued and the holes show up on their own, as 10-11 and 13-19. By default only runs of three or more become a range, since writing 7-8 usually costs more space than it saves; flip the pair option if you want the opposite.

Frequently asked questions

My data uses 5..9 instead of 5-9. Do I have to convert it first?
No. Double dots and en dashes are always accepted on input, whatever the settings say. The range marker field decides what else counts as a range and, more to the point, what comes out when compacting: put .. there and the compacted output reads 1..7 instead of 1-7.
My document numbers carry leading zeros, like 007. Do they survive?
Only if you tick the leading zeros option. With it on, the tool measures the widest number in the input and pads the whole output to that width, so 007-010 gives back 007, 008, 009, 010. The width comes from the input, so a single four-digit item makes every result four digits wide.
Is there a cap on how many numbers an expansion can produce?
The default ceiling is 100,000 items and it sits in an editable field. The count runs before anything is generated, so a mistyped 1-3000000 will not freeze the page: you get a message saying how many items it would produce and nothing is written. Raise the limit if your case genuinely needs more.

Related Tools