If Cell B2 and B4 equals 6 then sum C2 and C4 into D2

I need an excel formula that looks across a row and evaluates if (B:B) contains N6 then sums all values in row into D2. e.g.  if | B2 = 6 and C2  = 2 | ,  B4 = 6 and C4 = 20 | then D2 = C2+C4 or 2+20 = 20. If you need further information please ask. Thanks in advance :)
Jehoshaphat DomfehAsked:
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.


Your question is quite confusing.

You want a formula to check each cell in the whole of Column B (B:B which would be just over a million cells if working on an xlsx format), and sum up column C from the corresponding cells if the cell in B equals whatever is in N6?

However, in your example, you use a fixed value of '6'.

Do you mean cell N6 or a fixed value of 6?

Also, your example includes a final result of 2 + 20 = 20.  Is that a typo, or do you mean you want to return the largest value from any corresponding cell in Column C (which in your example is 20).

Please clarify and / or correct any typos.


Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
I think you need this...


Open in new window

ShumsExcel & VBA ExpertCommented:
Hi Jehoshaphat,

Welcome to Expert Exchange!

If you are referring to cell N6, then you may try below;

Open in new window

or you may use Subodh's formula.

If you are referring to number 6 then you may use below formula:

Open in new window


Open in new window

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
Jehoshaphat DomfehAuthor Commented:
Thanks everyone for the support :) the formula i needed was the =SUMIF(B:B,6,C:C)
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Based on asker's feedback.
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 Applications

From novice to tech pro — start learning today.