I used to run into this problem all the time.
I’d have several individual objects and one larger overlapping object, which I wanted to combine in some way using Illustrator’s Pathfinder effects.
Using the above as an example, let’s say I wanted to subtract the green square from the black squares to create a shape like this:
When I first started learning about Pathfinder effects, my instinct was to simply select both the green and black squares and apply the Minus Front effect. However, I soon found that this didn’t work as I expected it to. Instead of creating the shape above, I’d get something like this:
Trying to group or unite the black squares before applying the effect didn’t work either, the result would always be the same.
At the time, I presumed that Pathfinder effects could only be applied to one object at a time.
From then on, whenever I ran into this problem, I’d get around it by making copies of the overlapping object and using those copies to apply the Minus Front effect to each of the individual objects behind it.
It wasn’t until a few years later that I discovered my presumptions about Pathfinder effects were wrong—applying them to multiple objects can be done.
All you need is the magic of a Compound Path.
What is a Compound Path?
A Compound Path is very similar to a Group in that it’s a “group” of multiple objects. The difference is that when applying Pathfinder effects to Groups, the individual objects that make up that group are treated as separate elements, where as the objects that make up a Compound Path are treated as one.
This enables us to apply Pathfinder effects to multiple objects at once.
How it’s done
To make a Compound Path, select all of the objects you want to include (in this case, it would be all of the black squares) and go to Object > Compound Path > Make.
Once you’ve done that, hold Shift and select the overlapping object (in this case, the green square), then go to the Pathfinder panel (Window > Pathfinder) and click Minus Front.
This will subtract the overlapping object from the objects behind it all at once.
Experiment with the other Pathfinder effects too and you’ll see just how much easier Compound Paths can make building complex shapes.