My countif statement isn't working.

I have a count if statement that isn't working. On Sheet 1, column a, i have lots of different names. Many rows in column a are the same. In column b there is a value next to it. On sheet two, i put my count if statement. Say in sheet 2, column a, i have the name Ryan. In column b of sheet 2, i am trying to total all of those values on sheet 1, column b that have a value next to the name ryan, in column a. Does that make sense? So, i created a formula like this: =if(countif(sheet1!A:B,sheet2!A1),vlookup(sheet2!A1,sheet1!A:B,2,0),0). This formula has worked in the past, but for some reason its not right now. On Sheet 2, how do i sum up all of the values next  to Ryan on sheet 1? Thanks!!!!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

barry houdiniCommented:
Sounds like you need SUMIF not COUNTIF, e.g. in sheet 2 B1 use this formula


assumes you have the name in sheet2! A1

regards, barry

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If I understand correctly, this?

tols12Author Commented:
That worked. Thank you!!!!!!!!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.