Does the sentry's Guardian Shield protect units from ranged attacks if the attackers are inside the shield?

Guardian shield confers the damage reduction to all friendly unit inside its radius, regardless of the location of the source inflicting the damage. It doesn't matter if the enemy is inside or outside the shield.

EDIT: some ranged units (specifically hydralisks and roaches) have an alternate attack animation when they are in melee range. This attack does not count as a ranged attack - so it is not affected by guardian shield or point-defense drones. Moving these units into close proximity with the units defended by the guardian shield can be beneficial, then, but again it has nothing to do with whether the attacker is actually inside the guardian shield or not.