Welcome to the board.
That would require VBA.
You could instead use columns A & B as input, and C & D to calculate:
Code:
--A-- -B-- --C-- --D--
1 Hours Days Hours Days
2 16 16 2
3 3 24 3
4 1 1 Error Error
C2 and down: =CHOOSE(ISNUMBER(A2) + 2 * ISNUMBER(B2) + 1, "", A2, 8 * B2, "Error")
D2 and down: =CHOOSE(ISNUMBER(A2) + 2 * ISNUMBER(B2) + 1, "", A2 / 8, B2, "Error")