Is it possible to have a field populate only if a certain set of fields is different? Here's what I'm working with:

My goal is to have the Special Remarks field shown only when there is a difference in last name in the tables above.

I'm currently trying to get the "Show Special Remarks?" field to populate a value based on a formula that I'm using: IF(Last1=Last2=Last3,"Same","Different"), though I'm not even sure if the IF function can handle that logic. I'm planning to hide that field and then use it to determine whether or not to display the "Special Remarks" field, as that is required if the last names of the individuals on this form are different.

One potential complication is that not all three of those tables (self, spouse, and child) will always be in use. Depending on what is selected previously in the form, one, two, or all three of these will be required. To further add to the complexity, additional rows can be added to the child table.

Is this even possible? If so, any help would be greatly appreciated!