Hi All,
I am currently having a problem with an array formula which I think needs to use the AND function (and this may be what is causing it not to work).
I have a spreadsheet containing monitoring data for household water usage and the data set consists of about 1000 houses of various types (different occupancy rates and type of house, e.g. detached, semi-detached etc). There are three columns: the average monthly water use. household occupancy (1-6) and household type (detached = D, semi-detached= S, Terraced = T and Other = 0).
Basically I need to work out the average by house occupancy and house type. So for instance what is the average monthly water usage of all detached houses with 1 occupant?
I created an array formula that works if I only want to know the average of, for example, water use in 1 person households (regardless of the type of house). E.g.
{=AVERAGE(IF(DI2:DI1113=1,DL2:DL1113))}
Where column DI is the occupancy rates and column DL is the average monthly water usage.
However whenever I try and filter for house occupancy and house type by incorporating the AND function, I just get a value of zero returned. Here is the formula I am currently using:
{=AVERAGE(IF(AND(DI2:DI1113=1, DJ2:DJ1113="D"), DL2:DL1113))}
Where column DJ is the house type. So I would read the above as: For all cells in the range DI2:DI1113 and DJ2:DJ1113, check to see which have the combination of "1" and "D" and then work out the corresponding averages from the range DL2:DL1113.
However it doesn't work and I just get zero (I have checked and there are cells that have non-zero values that meet the criteria so it definitely shouldn't be zero). All I can think is that the AND statement is making it not work but I don't know why.
Thanks in advance for any help.
Regards
Rob
Bookmarks