Hi Ada,
that's a bit of a tricky layout you got there. In general, it is better not to have blank rows interspersed with data/summary rows, because it will make it so much harder to come up with a formula that can be copied down.
Your formula always returns Task1 etc, because the first IF condition is always true, no matter in which cell you ask it. So you need a way to tell Excel to test a condition in relation to the current row, or return a value in relation to the current row.
A formula that will return the results that you need could be:
Note that this one does not even use your range names, but it can be applied to all the result cells and will deliver what you specified.
With regards to sorting the results, so that the blank results are pushed to the bottom of the list: with this layout it will be difficult.
In general, you may want to have a look at pivot tables to see how you could report on and summarize data without the need for dozens of range names or complicated formulas.
cheers
Bookmarks