Remember memory will be allocated only when it is needed - so if the VM is using4 GB out of the 8GB the other 4 will be available for user the other VMs on the host -
For the resource pool with 24 GB created the VMs with 8 GB of memory the most memory they will ever use is 8 GB so in your example if only two of the 3 VMs in use they will use a maximum total of 16 GB - and if both VMs are running on the same ESXi host it will actually be less then 16 GB because the ESXi host will only store identical memory pages from the VMs one - this process is called Transparent Page Sharing -
There is no way for a VM to dynamically expand its memory