Share via

IF Function, using values from (2) different columns

Anonymous
2017-08-10T21:46:33+00:00

Hello,

I have (4) different criteria that are possible data in column G (example: red, blue, yellow, green).  I have dollar amounts in column C.  I want to do a formula as follows:

If the values in each cell of column G are 'yellow' or 'green' (either/or), add up the corresponding row dollar amount from column C.

How do I do that?

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2017-08-11T08:45:51+00:00

    Prefer Murray's formula ... you may use SUMIF instead:

    =SUM(SUMIF(G2:G10,{"green","yellow"},C2:C10))

    Regards,

    Amit Tandon

    Was this answer helpful?

    0 comments No comments
  2. Ashish Mathur 101.9K Reputation points Volunteer Moderator
    2017-08-10T23:35:16+00:00

    Hi,

    Try this

    =SUMPRODUCT(($C$2:$C$100)*(($G$2:$G$100="Yellow")+($G$2:$G$100="Green")))

    Hope this helps.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2017-08-10T23:06:07+00:00

    One way:

    =SUM(SUMIFS(C4:C11,G4:G11,{"Green","Yellow"}))

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2017-08-10T23:05:29+00:00

    Hi Amanda,

    You could apply an IF Function to each row:

    =IF(OR(G2="Yellow",G2="Green"),C2,0)

    Then sum the column containing those formulas.

    However, if you want all of that to be calculated in a single cell you would need:

    {=SUM(IF(G2:G6="Yellow",C2:C6,0),IF(G2:G6="Green",C2:C6,0))}

    This formula assumes all the data is in rows 2 through 6.  It is an array formula, so you don't type the { } curly brackets.  Enter the formula, then press Ctrl + Shift + Enter to input the formula.

    Was this answer helpful?

    0 comments No comments