OK, you had me scratching my head, as I use Excel for just about everything, and am always writing formulas, so couldn't understand why you were getting an error message.
Then it dawned on me, I have Excel 2010 on my laptop, so something might have been changed/updated in Excel 2013.
Other than that, did you also set cell C2 to be the same Time format? Below is a screenshot of what I got when I just tried it. The first row, however, showed AM instead of PM, probably because it's working on a 24 hour clock, so in the fourth row, I typed in the times in 24 hour format, but for some reason C4 is showing AM rather than PM, so not sure how to get that to display PM, unless I actually typed in the correct time, or IOW, if I typed 16:10 PM, which obviously isn't what you want.
Edited to Add: OK, I just tried deleting the PM from the A4 and B4 cells and it removed it from the C4 cell, and now it's showing the time, but not indicating whether it's AM or PM. Again, I'm not sure why you are having an issue with Excel 2013, as I'm not getting any error messages.
Edited to Add 2: OK, I think I figured out what to do as far as displaying the proper time, and not having the C4 cell showing AM instead of PM as the A4 and B4 are displaying.
Check out how I formatted the 3 cells, and it should work the way you want it to. If you still get the error message, then I have no idea what's causing it. You will still need to type the numbers in the A and B cells in 24 hour format, as I mentioned above.