missilepilot
New Member
- Joined
- Jun 6, 2017
- Messages
- 8
So I need to compute the average number of days between two columns, with multiple instances of each start and end date, across multiple sheets, and only including cells that occur in a row with a matching value.
=AVERAGE(DAYS(IF(MATCH(B4,INDIRECT("'" &SHEETLIST& "'!$B3:$B300")),INDIRECT("'" &SHEETLIST& "'!$H3:$H300")),IF(MATCH(B4,INDIRECT("'" &SHEETLIST& "'!$B3:$B300")),INDIRECT("'" &SHEETLIST& "'!$E3:$E300"))))
Is where I'm at so far. SHEETLIST is the list of all sheets, looking for a match in B3:B300 of those sheets, and then comparing the distance between dates listed in H3:H300 and E3:E300 of those sheets, computing the average number of days utilizing those ranges, and returning it to a summary sheet. Column H will not always contain a date, in that case I want it to use today's date for determining time elapsed. I realize i'm getting close to the boundaries of what formulas are capable of, but my knowledge of VBS is limited. I am studying VBS, but i need to complete this workbook in a timely fashion. Any help would be greatly appreciated.
[TABLE="width: 821"]
<colgroup><col style="width:59pt" width="79"> <col style="width:128pt" width="171"> <col style="width:95pt" width="126"> <col style="width:93pt" width="124"> <col style="width:56pt" width="75"> <col style="width:113pt" width="150"> <col style="width:72pt" width="96"> </colgroup><tbody>[TR]
[TD="class: xl95, width: 79"]CUST ID #
[/TD]
[TD="class: xl96, width: 171"]NAME
[/TD]
[TD="class: xl96, width: 126"]SALES
[/TD]
[TD="class: xl19, width: 124"]INVOICE DUE DATE[/TD]
[TD="class: xl98, width: 75"]AMOUNT[/TD]
[TD="class: xl23, width: 150"]REASON
[/TD]
[TD="class: xl19, width: 96"]DATE COMPLETE
[/TD]
[/TR]
[TR]
[TD="class: xl25, width: 79"]1234
[/TD]
[TD="class: xl22"]John Doe
[/TD]
[TD="class: xl22"]Dr. Dre
[/TD]
[TD="class: xl23, width: 124"]7/1/2017
[/TD]
[TD="class: xl23, width: 75"]$3.50
[/TD]
[TD="class: xl23, width: 150"]Other[/TD]
[TD="class: xl22"]7/18/2017
[/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"]1234
[/TD]
[TD="class: xl22"]Jane Doe
[/TD]
[TD="class: xl22"]Dr. Dre
[/TD]
[TD="class: xl23, width: 124"]7/1/2017
[/TD]
[TD="class: xl23, width: 75"]$3.50[/TD]
[TD]Mismatch
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"][/TD]
[TD="class: xl33, width: 171"][/TD]
[TD="class: xl33, width: 126"][/TD]
[TD="class: xl33, width: 124"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"][/TD]
[TD="class: xl33, width: 171"][/TD]
[TD="class: xl33, width: 126"][/TD]
[TD="class: xl33, width: 124"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"][/TD]
[TD="class: xl33, width: 171"][/TD]
[TD="class: xl33, width: 126"][/TD]
[TD="class: xl33, width: 124"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"][/TD]
[TD="class: xl33, width: 171"][/TD]
[TD="class: xl33, width: 126"][/TD]
[TD="class: xl33, width: 124"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"][/TD]
[TD="class: xl33, width: 171"][/TD]
[TD="class: xl33, width: 126"][/TD]
[TD="class: xl33, width: 124"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"][/TD]
[TD="class: xl33, width: 171"][/TD]
[TD="class: xl33, width: 126"][/TD]
[TD="class: xl33, width: 124"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"][/TD]
[TD="class: xl33, width: 171"][/TD]
[TD="class: xl33, width: 126"][/TD]
[TD="class: xl33, width: 124"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
=AVERAGE(DAYS(IF(MATCH(B4,INDIRECT("'" &SHEETLIST& "'!$B3:$B300")),INDIRECT("'" &SHEETLIST& "'!$H3:$H300")),IF(MATCH(B4,INDIRECT("'" &SHEETLIST& "'!$B3:$B300")),INDIRECT("'" &SHEETLIST& "'!$E3:$E300"))))
Is where I'm at so far. SHEETLIST is the list of all sheets, looking for a match in B3:B300 of those sheets, and then comparing the distance between dates listed in H3:H300 and E3:E300 of those sheets, computing the average number of days utilizing those ranges, and returning it to a summary sheet. Column H will not always contain a date, in that case I want it to use today's date for determining time elapsed. I realize i'm getting close to the boundaries of what formulas are capable of, but my knowledge of VBS is limited. I am studying VBS, but i need to complete this workbook in a timely fashion. Any help would be greatly appreciated.
[TABLE="width: 821"]
<colgroup><col style="width:59pt" width="79"> <col style="width:128pt" width="171"> <col style="width:95pt" width="126"> <col style="width:93pt" width="124"> <col style="width:56pt" width="75"> <col style="width:113pt" width="150"> <col style="width:72pt" width="96"> </colgroup><tbody>[TR]
[TD="class: xl95, width: 79"]CUST ID #
[/TD]
[TD="class: xl96, width: 171"]NAME
[/TD]
[TD="class: xl96, width: 126"]SALES
[/TD]
[TD="class: xl19, width: 124"]INVOICE DUE DATE[/TD]
[TD="class: xl98, width: 75"]AMOUNT[/TD]
[TD="class: xl23, width: 150"]REASON
[/TD]
[TD="class: xl19, width: 96"]DATE COMPLETE
[/TD]
[/TR]
[TR]
[TD="class: xl25, width: 79"]1234
[/TD]
[TD="class: xl22"]John Doe
[/TD]
[TD="class: xl22"]Dr. Dre
[/TD]
[TD="class: xl23, width: 124"]7/1/2017
[/TD]
[TD="class: xl23, width: 75"]$3.50
[/TD]
[TD="class: xl23, width: 150"]Other[/TD]
[TD="class: xl22"]7/18/2017
[/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"]1234
[/TD]
[TD="class: xl22"]Jane Doe
[/TD]
[TD="class: xl22"]Dr. Dre
[/TD]
[TD="class: xl23, width: 124"]7/1/2017
[/TD]
[TD="class: xl23, width: 75"]$3.50[/TD]
[TD]Mismatch
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"][/TD]
[TD="class: xl33, width: 171"][/TD]
[TD="class: xl33, width: 126"][/TD]
[TD="class: xl33, width: 124"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"][/TD]
[TD="class: xl33, width: 171"][/TD]
[TD="class: xl33, width: 126"][/TD]
[TD="class: xl33, width: 124"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"][/TD]
[TD="class: xl33, width: 171"][/TD]
[TD="class: xl33, width: 126"][/TD]
[TD="class: xl33, width: 124"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"][/TD]
[TD="class: xl33, width: 171"][/TD]
[TD="class: xl33, width: 126"][/TD]
[TD="class: xl33, width: 124"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"][/TD]
[TD="class: xl33, width: 171"][/TD]
[TD="class: xl33, width: 126"][/TD]
[TD="class: xl33, width: 124"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"][/TD]
[TD="class: xl33, width: 171"][/TD]
[TD="class: xl33, width: 126"][/TD]
[TD="class: xl33, width: 124"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl34, width: 79"][/TD]
[TD="class: xl33, width: 171"][/TD]
[TD="class: xl33, width: 126"][/TD]
[TD="class: xl33, width: 124"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]