unsigned long rpm = 0;
If you are expecting rpm values greater than 32, 767, you are dreaming.
rpm=((15000)/(millis()-timeold))*rpmcount;
Magic numbers don't cut it.
timeold = millis();
int time = (millis()/1000);
int timedec = (millis()% 1000);
rpmcount = 0;
You've got a shitload of slow stuff going on before you reset rpmcount. Hope that +/- 50% is good enough.
So, what is the problem with the code?