is this a day trip or not?
If time does not matter, then going via Sheffield is cheaper. It would be quicker via Grantham but would cost more.
In the old fares manual (I don't have the new one), assuming you want the cheapest and assuming it's not a day trip:-
York - Sheffield SDS £3.80 (x2 to make a return)
York - Newcastle SOR £11.50
Newcastle - Berwick SOR £8.15
Berwick - Edinburgh SOR £8.50
Total £35.75
Although I do wonder if it's worth it when a SHF-EDB SOR is £40.50
For the up-to-date fares you'd have to ask a ticket office (or can NRES do staff fares?) or maybe hairhyhandedfool can look it up...
--- old post above --- --- new post below ---
bit out of the way
It is a bit out of the way to go via MAN, but it would almost certainly be the cheapest option, if a cheap AP fare is available on the sardine can express.