# Thread: Populating a Cell Based Off of Two Columns Values Thanks:  1 Post #5310524 (1) Likes:  1 Post #5310524 (1)

1. ## Populating a Cell Based Off of Two Columns Values

Hello again everyone,

I have two columns that I want to compare data and fill in a single cell with the SUM of one of those columns.

The first column is K. The cells are populated from K2:K59. There are 7 different values randomly listed in this column: Custom, Small Industrial, Lighting, SEM, Custom O&M, Prescriptive and Green Rewind. The second column, AT, has numerical values, also populated from AT2:AT259. I want to use a code that looks at column K to see which cells list "Custom." I want it to sum up the numerical values from column AT that correlate to "Custom" and sum up their values into a single cell.

I tried using this code to start:

=VLOOKUP(K2:K259,AT2:AT259,2,FALSE)

However, I feel as though I may need to use an IF and SUM statement to tell it to only look at the cells labeled "Custom" but am not sure how to format it.

If this doesn't make sense feel free to ask any questions.

Thanks everyone!

2. ## Re: Populating a Cell Based Off of Two Columns Values

Hi,

Sounds like you just need SUMIF.

Use this with the criteria hard coded:

=SUMIF(K2:K259,"Custom",AT2:AT259)

Use this with a cell reference for the criteria, you can change A1 to whatever you want to SUM:

=SUMIF(K2:K259,A1,AT2:AT259)

3. ## Re: Populating a Cell Based Off of Two Columns Values

I didn't even think about using the SUMIF function.

Thank you so much, you made my life about 100 times easier.

4. ## Re: Populating a Cell Based Off of Two Columns Values

You're welcome, welcome to the forum, and thanks for the feedback.