Remember the IIf() is
IIf(condition, true path, false path)
And either or both the true path or the else path can be nested. This is why you need to indent properly so you'll see what path you are on.
IIf(condition, truepath IIf(condition2, true path, false path), falsepath IIf(condition3...