( by rmeghdie )
Have a look at the following screenshot:
I have the following formula in Cell E2:
the above formula will give you the result for "y" as we have "y" in Cell E1.
And if you change the value of Cel E1 to "d", then it will give you the result as 7 in Cell E2.
And you can also have a group by query, I have the following formula in Cell G1:
=query(A:B;"select A,sum(B) where A <>'' group by A label sum(B) 'Total' ";1)
the above formula will auto generate the table by summing all the unique values of Column A.