Solved Formula for auto num

November 23, 2012 at 01:01:15
Specs: Windows XP
I have a list of data as below,
TIGER
TIGER
ANTS
FISH
FISH
FISH

I need the data's to be numbered into,
1. TIGER
TIGER
2. ANTS
3. FISH
FISH
FISH

Any idea how to sort it?


See More: Formula for auto num

Report •


#1
Report •

#2
November 23, 2012 at 13:05:01
✔ Best Answer
and here is batch attempt:
::==== begin batchscript
@echo off & setlocal enabledelayedexpansion
set prev=.
for /f "tokens=*" %%a in (animals) do (
if /i "%%a" neq "!prev!" (
set /a num+=1
set numout=!num!.
) else (
set numout=
)
echo !numout!%%a
set prev=%%a
)
::==== end batchscript

Report •
Related Solutions


Ask Question