Computer Hope

Other => Other => Topic started by: petie86 on January 28, 2018, 12:54:48 PM

Title: Looking for some excel help
Post by: petie86 on January 28, 2018, 12:54:48 PM
Not sure if right place did try to search but couldn't find anything.

What I'm trying to do is get the sum of numbers in 1 column but only if the rows in another column evaluate to true
for example, Column A is for Male/Female (1 for male, 0 for female) column B is how much each spends on shopping.
I want the average Male spend, and then the average female spend.
So was thinking along the lines of a countif (a2:a50, "0",b2:b50) ??
All i have managed so far playing around is o count how many 1's or 0's but not the sum, if you know what I mean?
Title: Re: Looking for some excel help
Post by: BC_Programmer on January 28, 2018, 02:47:40 PM
There are a number of other 'IF' Functions. It sounds like you want AVERAGEIF rather than COUNTIF. There is also SUMIF. They all work the same way as COUNTIF. First argument specifies the range to look for the criteria. second argument is the criteria to look for in the first argument range, and last argument is the range of corresponding values to sum. Should be a "drop-in"  replacement for COUNTIF in your formula.
Title: Re: Looking for some excel help
Post by: petie86 on January 29, 2018, 01:51:10 AM
Thank you, worked a treat, used [ =averageif(a2:a100,"0",b2:b100) ]