That condition is correct. Then you need explain clearly what you are trying to do and post the whole trigger text of the spell, because your description of "doesn't work" doesn't give us any information upon which to base a solution.
How To Post Your Trigger
If your spell targets an area or a point (instead of a unit) this condition will fail and you will have to check each potential target individually.