View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Steve[_124_] Steve[_124_] is offline
external usenet poster
 
Posts: 12
Default Help please, this is driving me mad!

Any advice, suggestions or help with this would be greatly appreciated. My head's spinning!

I've been trying to analyse data about homes' cavity walls. I've tried using a Pivot Table and got close to it, but couldn't see how to do the "date-span" part in a PT. I have tried adding helper columns with COUNTIFS but I've not quite got the right answer with that.

I've copied a few rows of basic data at the foot of this post, but my spreadsheet contains (among other info):-

a Company Number, company name, an address, assessment date, wall type

"Wall type" is a crucial piece of the information and each record contains one of the following:-

Cavity wall, as built, partial insulation (assumed)
Cavity wall, with internal insulation
System built, as built, partial insulation
System built, as built, no insulation
Cavity wall, filled cavity

My analysis needs to do the following:-

1) If a company has performed an Assessment and the result is "Cavity wall, filled cavity" and there are 1 or 2 performed we flag it as a "?" (a question mark); if the result is "Cavity wall, filled cavity" and there are 3 or more we flag it as an "X" (an X)

2) If a company has performed an Assessment and the result is any of the below, we mark it as a "Tick".

Cavity wall, as built, partial insulation (assumed)
Cavity wall, with internal insulation
System built, as built, partial insulation
System built, as built, no insulation

However, we also need to take the next point into consideration . . .

3) If the assessments were carried out within a 2-day span of each other (if there were assessments performed by the same company within 2 days before and 2 days after each date - indicating there have been a lot done in a short space of time), and there are more than four of them, we mark it with an "X"

I've laid out some test data is below. There are thousands of actual records.

Column A - company number
Column B - company name (the company name is rarely populated for all entries)
Column G - EPC Address (nothing special, just an address)
Column T - assessment date
Column Z - wall type
the data continues to column BD - csco_rural

A B G T Z BD
Company Number Company Name EPC Address assessment_date wall_type csco_rural
781618 Flat 5 Foreland Court 29/07/2016 Cavity wall, as built, partial insulation (assumed)
781618 Flat 8 Foreland Court 28/11/2015 Cavity wall, as built, no insulation (assumed)
781618 Flat 17 Foreland Court 04/11/2015 Cavity wall, as built, no insulation (assumed)
781618 Flat 18 Foreland Court 14/11/2014 Cavity wall, filled cavity
781618 Flat 6 Foreland Court 23/07/2013 Cavity wall, filled cavity
781618 Flat 7 Foreland Court 06/04/2013 Cavity wall, as built, no insulation (assumed)
781618 FORELAND Flat 1 Foreland Court 13/11/2012 Cavity wall, as built, no insulation (assumed)
781618 Flat 9 Foreland Court 03/05/2012 Cavity wall, with internal insulation
781618 Flat 19, Foreland Court 16/08/2011 Cavity wall, as built, insulated (assumed)
781618 Flat 10 Foreland Court 15/03/2011 System built, as built, partial insulation (assumed)
781618 Flat 16, Foreland Court 12/08/2009 Cavity wall, as built, no insulation (assumed)