from_selection() is used in Action Chains Formula action to perform mathematical operations that needs input from more than one book.
Templates for composite columns only work for mathematical operations that pulls the data from one book at at time.
If I understand what you want to do correctly, your template should look like this:
Code:
program:
$$#pagecount / 320