K
Kamila
Hi
I am very new to use with Excel programming but have some idea how to use
Excel. I have question
I have 3000 ID numbers. Length of ID number is must be 11 and i have one
formula for checking of right IDs and i want to use that formula in Excel
2003 to check right ID and give me result of wrong or right IDs.
How can i use that forumula in the Excel? I make formula in the Java script
and dont know how to use in Excel 2003.
<html>
<head>
<title> JScript for checking ID no </title>
</head>
<body>
<form action="" name="pnform">
<input type="button" value="Persnr" onclick="ValidateID()">
</form>
<script type="text/jscript">
function ValidateID()
{
var ID="22037035991" //!! ID no must be 11 sifer, it is right ID no.
var TmpStr
var Tmpr
var vekt1 = "376189452"
var vekt2 = "5432765432"
var tot = 0
var base = 11
var value
var vekt
var TmpStr2
var Tmpr2
var vekt2 = "5432765432"
var tot2= 0
var base = 11
// for first number
for (i=0;i<9 ;i++)
{
value = ID.substr(i,1)
vekt = vekt1.substr(i,1)
tot = tot + (parseInt(value) * parseInt(vekt))
}
i=tot/11
i=tot-(parseInt(i)*11)
i=11-i
TmpStr = ID
TmpStr = ID.substr(9,1)
Tmpr=(ID.length)
// for second number
for (y = 0; y < 10 ; y++)
{
value = ID.substr(y,1)
vekt = vekt2.substr(y,1)
tot2 = tot2 + (parseInt(value) * parseInt(vekt))
}
y=tot2/11
y=tot2-(parseInt(y)*11)
y=11-y
TmpStr2 = ID
TmpStr2 = ID.substr(10,1)
Tmpr2=(ID.length)
// integer check
if (base!=Tmpr)
{
document.write("You must enter 11 number for ID (0 - 9) ")
}
else if ( parseInt(i)==TmpStr && parseInt(y)==TmpStr2)
{
document.write("Thanks for right ID no.")
}
else
{
document.write("Wrong ID no.")
}
}
</script>
</body>
</html>
These are some correct ID Numbers
06084718767
05056021762
10065032304
02077539088
This number is also correct "22037035991"
These are some wrong ID Numbers
31074227037
09055119719
30468331842
15196221735
I just findout bad or wrond ID numbers.
best regards,
I am very new to use with Excel programming but have some idea how to use
Excel. I have question
I have 3000 ID numbers. Length of ID number is must be 11 and i have one
formula for checking of right IDs and i want to use that formula in Excel
2003 to check right ID and give me result of wrong or right IDs.
How can i use that forumula in the Excel? I make formula in the Java script
and dont know how to use in Excel 2003.
<html>
<head>
<title> JScript for checking ID no </title>
</head>
<body>
<form action="" name="pnform">
<input type="button" value="Persnr" onclick="ValidateID()">
</form>
<script type="text/jscript">
function ValidateID()
{
var ID="22037035991" //!! ID no must be 11 sifer, it is right ID no.
var TmpStr
var Tmpr
var vekt1 = "376189452"
var vekt2 = "5432765432"
var tot = 0
var base = 11
var value
var vekt
var TmpStr2
var Tmpr2
var vekt2 = "5432765432"
var tot2= 0
var base = 11
// for first number
for (i=0;i<9 ;i++)
{
value = ID.substr(i,1)
vekt = vekt1.substr(i,1)
tot = tot + (parseInt(value) * parseInt(vekt))
}
i=tot/11
i=tot-(parseInt(i)*11)
i=11-i
TmpStr = ID
TmpStr = ID.substr(9,1)
Tmpr=(ID.length)
// for second number
for (y = 0; y < 10 ; y++)
{
value = ID.substr(y,1)
vekt = vekt2.substr(y,1)
tot2 = tot2 + (parseInt(value) * parseInt(vekt))
}
y=tot2/11
y=tot2-(parseInt(y)*11)
y=11-y
TmpStr2 = ID
TmpStr2 = ID.substr(10,1)
Tmpr2=(ID.length)
// integer check
if (base!=Tmpr)
{
document.write("You must enter 11 number for ID (0 - 9) ")
}
else if ( parseInt(i)==TmpStr && parseInt(y)==TmpStr2)
{
document.write("Thanks for right ID no.")
}
else
{
document.write("Wrong ID no.")
}
}
</script>
</body>
</html>
These are some correct ID Numbers
06084718767
05056021762
10065032304
02077539088
This number is also correct "22037035991"
These are some wrong ID Numbers
31074227037
09055119719
30468331842
15196221735
I just findout bad or wrond ID numbers.
best regards,