A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
The short answer is that the "md" unit of DATEDIF is the problem — it's undocumented, and it's known to be unreliable. Excel and SharePoint count the leftover days slightly differently when the end date's day-of-month is smaller than the start date's, which is why every mismatch in your table is off by exactly 1.
The safest fix is to stop using "md" altogether. Get the whole months first, then work out the leftover days with plain subtraction:
Whole months: =DATEDIF(A2,B2,"m")
Leftover days: =B2-EDATE(A2,DATEDIF(A2,B2,"m"))
Using your first row as an example (03/04/2021 to 01/04/2027): that gives 71 whole months, and 01/04/2027 minus EDATE(03/04/2021, 71) = 29 days. Both Excel and SharePoint give the same result with this version, because it only uses the "m" unit, which both engines handle the same way.