Were the tribe of Levi included in the earlier census?
(1,1) “Hashem spoke to Moshe in the wilderness of Sinai, in the Tent of Meeting, on the first day of the second month of the second year of their exodus from Egypt, saying: Take a census of all the congregation of the Children of Yisrael according to their families, according to their fathers’ houses, according to the number of names, every male according to their head count.”
Rashi explains that because of Hashem’s affection for Yisrael, He repeatedly counts them. When they went out from Egypt He counted them (Shemos 12:37), and when they fell because of the sin of the golden calf He counted them in order to know how many remained (Shemos 38:26), and when He was about to bring His Divine Presence to dwell amongst them He counted them again.
Why did Rashi explain the reason for the counting which took place before the building of the Mishkan here, rather than in its place?
It seems that Rashi explains this here in keeping with his opinion in parshas Ki Sisoh (Shemos 30:16), which is the opinion of Chazal in the Midrash on this parsha, that the census in parshas Pekudei which took place in Tishrei of the first year and the census in parshas Bamidbar which took place in Iyar of the second year both came to 600,550 because they counted the men from Tishrei. That is, their age was not reckoned according to their individual birthdays, but instead every Tishrei the age of all the men advanced one year, and thus both counts took place within the same year. Because of this one might ask that if so, why were those same men which had already been counted once, counted again in Iyar? To answer this Rashi explains that because of Hashem’s affection for Yisrael, He repeatly counted them.
But the opinion of the Ramban and the Abarbanel is that the first census included the tribe of Levi, but not the second census. The Abarbanel brought a proof for this from the fact that in the second census Hashem told Moshe “but the tribe of Levi do not count” (Bamidbar 1:49), which implies that they were counted the first time. In their opinion the count was the same both times because the counting of the men’s age even in the wilderness was according to their individual birthdays. and thus those men who had turned twenty by the time of the second census made up for the number that was missing by not counting the tribe of Levi. According to this opinion there is no need to explain that that this current census was because of Hashem’s affection for Yisrael, but rather it was a completely new count.
This is what Rashi comes to negate by explaining that the previous census was made in order to know how many remained after some of them died because of the sin of the golden calf. Thus there was no need to tell Moshe "do not count the tribe of Levi" at that time because it would never have occurred to Moshe to include them in that count since none of the tribe of Levi died because of the sin of the golden calf.
But in this current census which was made when He was about to bring His Divine Presence to dwell amongst them, Moshe might have thought that he should include the tribe of Levi in the count since they were closer to the Divine Presence. Therefore it was necessary to instruct Moshe not to incude them in the general census, and instead to count them by themselves for the reasons that Rashi explains. With this the words of Rashi are explained beautifully!