Zend certified PHP/Magento developer

Subtotal + Vlookup

I want to fill in these 2 cells with a formula.
Normally Id filter country for Canada and run a subtotal below.
with something like this =SUBTOTAL(9,J4:J8)

How can I combine a vlookup into my subtotal with subtotalling filtered countries?

enter image description here

enter image description here

enter image description here

expected output –
enter image description here

thanks.