ויבא כנען בארץ חברון הוא ארבע בקרית שרה ותמת” (ב כג) “ולכבתה ושרה לספד אברהם
The way of the world is that in a time if grief and pain, weeping precedes the eulogy. This is also understood from the words of the passuk in Yeshayah (22:12): “Vayikra Hashem...bayom hahu libchi ulemisped,” first weeping and then hesped. This also seems evident form the words of the Gemara (Moed Kattan 27b): “Three days for weeping and seven for eulogizing.” Why then, did Avraham precede the eulogy to the weeping?
Sefer Asifas Yehuda brings in the name of “a gaon” who explained this according to the ruling of the Shulchan Aruch (Orach Chaim 108 1), that if someone mistakenly did not daven one of the tefillos, he davens the next tefillah twice, the first for the obligation of the current tefillah and the second to complete the previous tefillah that he missed.
Because when Sarah passed away, Avraham was still on Har Hamoriah (Bereishis Rabbah 58 5), and because the way from there to Chevron, where Sarah passed away, took three days, as explained in the passuk (Bereishis 22:4), that on his way to Har Hamoriah he saw the mountain only on the third day of his departure, we find that he came back to Chevron at the end of the days of weeping. Therefore, like the din of one who forgot a tefillah, who has to first daven the current prayer and then to make up the missing one, likewise Avraham first fulfilled the hesped whose time had come and only later, did he complete the days of weeping that he had missed.
Asifas Yehuda [Frankfurt 5523}