Selecting faces by normals with Geometry Nodes

Hello, I am pretty much a noob learning geometry nodes, and apologize if this has been answered already (I may not have searched the right terminology) because it is a very basic challenge. I want to use geometry nodes to extrude the outward facing faces of instanced cubes. That is, I am instancing cubes on the boundary of a grid, and I want to extrude the faces pointing away from the center. If I use the dot-product node with the normal and a vector 100 or 010 I can select faces on the x or y axis, but it also selects faces pointing inward. If I calculate a vector from each face position to the center, I can compare this to the face’s normal to see if it is pointing outward, but it doesn’t work as well for faces closer to the corners. If the original grid is rectangular and not square, this test selects the wrong side of faces further out from the center. Here is a drawing of what I am trying to achieve:


I made this node group that has switches to extrude specific sides, thinking I would use it once for each side, but there must be a better way right?
Edit: only allowed to post one image, but you’re not missing anything not seeing my current node setup- it doesn’t work.
This is probably really simple and I do hope one day I understand this stuff well enough that I regret asking such a basic thing on a public forum- but I really am stuck here and would appreciate any solution that works. Note- I did find this answer already but I was hoping there was something simpler when only dealing with four directions.
Thanks to anyone who reads this!

If you take cubes surface position (world position) or vertex world position and subtract it from center position (which are center of the grid) you will gen a vector pointing from the center to outwards (or inwards, doesnt matter).
You can imagine this as a point light placed at grid center and how the light are spreaded.

Calculated DOT from this vector and world normal will get you a mask for inwards or outwards sides of the cubes.

Welcome!

Assuming your grid is square and centered then the normalized face position should dot to something greater than 1/sqrt(2) (~0.7)

To make it work with irregular rectangles you just need to divide the position by the dimensions.

Good luck.

Wow! This is brilliant and it works perfectly. Thank you!!