For book page no.
Formula: copy to clipboard
=IF(B20="","",IF(B20=1,"A"&SUM($B$20:B20),"A"&SUM($B$19:B19)+1&"-"&"A"&SUM($B$20:B20)))


For actual page no.
Formula: copy to clipboard
=IF(B20="","",IF(B20=1,SUM($B$20:B20),SUM($B$19:B19)+1&"-"&SUM($B$20:B20)))


This will work, only if B19 and B27 are empty. Because, B19/B27 are split again into sub sections. So, it will double count the page nos.