I have a chart in a spreadsheet which lists when tax credit applications were submitted, or approved for each of a number of film production companies. There are about 7 different kinds of tax credits I'm tracking, and there are about a dozen film production companies which file various applications based on which of the 7 tax credits they qualify for.
The chart is updated by another department with the filing dates as filings are submitted or approval dates as certifications are received. However, most productions last longer than 12 months, and therefore have to file twice. I am trying to present a high-level executive summary which includes an update of the status of all the filings for each production company and for my purposes only care about the last date in the cell (i.e. the date of the most recent submission/certification).
For example:
<tbody>
</tbody>
TaxCredit3 for ProdCo2: we filed on January 1, 2014 and again on January 1, 2015.
The format that the date is updated in is as seen above, so I put together an absurdly long formula that does an INDEX MATCH of the ProdCo name and the Tax Credit type... it then searches the string in the cell for the occurrence of a month, then spits out the entire date and then converts it into a date format that is recognizable by Excel:
It is particularly complex because I wrote it using INDIRECT() formulas so that I could just copy and paste it and it would work dynamically for all of the ProdCo's (each of which as a separate worksheet within the workbook). The ProdCo name is written in the $B$1 cell of each worksheet, B$39 through H$39 are the names of all the Tax Credits (the above formula is placed in the B$40 - H$40 cells, "y" and "x" are the named ranges of the chart which list all the ProdCos, and the Tax Credit types, respectively... and TC is the name of the chart worksheet.
Firstly, if someone could help me clean it up so it's more manageable (perhaps using VBA) that would be awesome.
But mainly my goal is to preform the same search, but skip to the last match... even if I could make the INDEX MATCH start from right to left would probably do it.
In any case, I'm lost in the woods.
If anyone here could offer any advice I'd be very grateful.
Thanks,
James
The chart is updated by another department with the filing dates as filings are submitted or approval dates as certifications are received. However, most productions last longer than 12 months, and therefore have to file twice. I am trying to present a high-level executive summary which includes an update of the status of all the filings for each production company and for my purposes only care about the last date in the cell (i.e. the date of the most recent submission/certification).
For example:
TaxCredit1 | TaxCredit2 | TaxCredit3 | TaxCredit4 | |
ProdCo1 | January 1, 2015 | January 1, 2015 | January 1, 2015 | January 1, 2015 |
ProdCo2 | January 1, 2015 | January 1, 2015 | January 1, 2014 / January 1, 2015 | January 1, 2015 |
ProdCo3 | January 1, 2015 | January 1, 2015 | January 1, 2015 | January 1, 2015 |
ProdCo4 | January 1, 2015 | January 1, 2015 | January 1, 2015 | January 1, 2015 |
<tbody>
</tbody>
TaxCredit3 for ProdCo2: we filed on January 1, 2014 and again on January 1, 2015.
The format that the date is updated in is as seen above, so I put together an absurdly long formula that does an INDEX MATCH of the ProdCo name and the Tax Credit type... it then searches the string in the cell for the occurrence of a month, then spits out the entire date and then converts it into a date format that is recognizable by Excel:
Code:
=IFERROR(DATEVALUE(IF(ISNUMBER(SEARCH("january",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,TC!$8:$8,0))))),IF(MID(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("January ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,17),10,1)=",", SUBSTITUTE(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("January ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,17)," "," 0",1),MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("January ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,16)),IF(ISNUMBER(SEARCH("february",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))),IF(MID(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("February ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,17),11,1)=",",SUBSTITUTE(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("February ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,17)," "," 0",1),MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("February ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,17)),IF(ISNUMBER(SEARCH("march",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,TC!$8:$8,0))))),IF(MID(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("March ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,14),8,1)=",",SUBSTITUTE(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("March ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,14)," ",0,1),MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("March ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,14)),IF(ISNUMBER(SEARCH("april",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,TC!$8:$8,0))))),IF(MID(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("April ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,14),5,1)=",",SUBSTITUTE(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("April ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,14)," ",0,1),MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("April ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,14)),IF(ISNUMBER(SEARCH("may",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,TC!$8:$8,0))))),IF(MID(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("May ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,12),5,1)=",",SUBSTITUTE(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("May ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,12)," ",0,1),MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("May ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,12)),IF(ISNUMBER(SEARCH("june",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,TC!$8:$8,0))))),IF(MID(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("June ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,13),5,1)=",",SUBSTITUTE(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("June ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,13)," ",0,1),MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("June ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,13)),IF(ISNUMBER(SEARCH("july",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,TC!$8:$8,0))))),IF(MID(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("July ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,13),5,1)=",",SUBSTITUTE(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("July ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,13)," ",0,1),MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("July ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,13)),IF(ISNUMBER(SEARCH("august",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,TC!$8:$8,0))))),IF(MID(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("August ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,15),5,1)=",",SUBSTITUTE(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("August ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,15)," ",0,1),MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("August ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,15)),IF(ISNUMBER(SEARCH("september",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,TC!$8:$8,0))))),IF(MID(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("September ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,18),5,1)=",",SUBSTITUTE(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("September ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,18)," ",0,1),MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("September ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,18)),IF(ISNUMBER(SEARCH("october",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,TC!$8:$8,0))))),IF(MID(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("October ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,16),5,1)=",",SUBSTITUTE(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("October ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,16)," ",0,1),MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("October ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,16)),IF(ISNUMBER(SEARCH("november",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,TC!$8:$8,0))))),IF(MID(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("November ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,17),5,1)=",",SUBSTITUTE(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("November ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,17)," ",0,1),MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("November ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,17)),IF(ISNUMBER(SEARCH("december",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,TC!$8:$8,0))))),IF(MID(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("December ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,17),5,1)=",",SUBSTITUTE(MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("December ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,17)," ",0,1),MID(INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))),FIND("December ",INDIRECT("TC!"&ADDRESS(MATCH($B$1,y,0),MATCH(B$39,x,0))))+0,17))))))))))))))),"")
It is particularly complex because I wrote it using INDIRECT() formulas so that I could just copy and paste it and it would work dynamically for all of the ProdCo's (each of which as a separate worksheet within the workbook). The ProdCo name is written in the $B$1 cell of each worksheet, B$39 through H$39 are the names of all the Tax Credits (the above formula is placed in the B$40 - H$40 cells, "y" and "x" are the named ranges of the chart which list all the ProdCos, and the Tax Credit types, respectively... and TC is the name of the chart worksheet.
Firstly, if someone could help me clean it up so it's more manageable (perhaps using VBA) that would be awesome.
But mainly my goal is to preform the same search, but skip to the last match... even if I could make the INDEX MATCH start from right to left would probably do it.
In any case, I'm lost in the woods.
If anyone here could offer any advice I'd be very grateful.
Thanks,
James