I am not sure how to even word this title, so if someone comes up with a better Title example, please let me know and I'll edit it.
I'm a semi-advanced Excel user in that I have taught some Excel classes (on shortcuts, pivot tables, excel formulas - basic and intermediate) but I'm not so advanced that I am super familiar or comfortable using Macros (except a simple one to create a keyboard shortcut, and even then I have to Enable Macros each time I open Excel) nor am I familiar with VBA. I think this is probably just a complex formula question, but I'm stuck so I'm hoping someone can help me.
Our company's accounting software does not create AR Customer Statements correctly, so I found out that the clerks are manually typing them line by line into an Excel template and then printing them to PDF and mailing them (60-75 customers a month x 2-8 invoices each x manual calculations DAYS of work). I figured I could expedite this a bit, and I started by exporting the current report of past due invoices (with columns for "Customer Name", "Invoice Number", "Invoice Date", "Invoice Due Date", "Terms", etc.) in one Worksheet (a tab called "Revised Aged AR") and I also created a new Template Statement in a tab called "Template". Then, I took the list of all the customers on the Revise Aged AR tab and copied them into a tab called "Current AR Customers" (removing all duplicates using the Remove Duplicates command). I then created a Macro (with the help of forums like this) that copies the Template tab and creates a new tab with the name of each customer, so that the template is duplicated 60 times except the name of the current customers receiving statements are the tab names. I also put in a formula where the customer's name would appear on the statement to change the cell containing the customer's name to match the name of the tab. Here is the formula I used for that: =MID(CELL("filename",A1),FIND("]",CELL("filename",A1),1)+1,255).
So far, so good. I can use Vlookups from another tab containing Customer Names and Addresses to fill in the address cells on each customer's statement, but what I am trying to do that isn't working correctly is to pull just that customer's lines of data off the Revised Aged AR tab and have it populate the statement. For example, let's say the data on the Revised Aged AR tab looks like this:[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Customer Name[/TD]
[TD]Invoice #
[/TD]
[TD]Inv Date
[/TD]
[TD]Terms
[/TD]
[TD]Due Date
[/TD]
[TD="align: right"]Amount[/TD]
[/TR]
[TR]
[TD]All World Roofing[/TD]
[TD]4348[/TD]
[TD]06/28/13[/TD]
[TD]Net 120[/TD]
[TD]10/26/3[/TD]
[TD="align: right"]989.85[/TD]
[/TR]
[TR]
[TD]All World Roofing[/TD]
[TD]4552[/TD]
[TD]11/27/13[/TD]
[TD]Net 120[/TD]
[TD]03/27/14[/TD]
[TD="align: right"]10,500.00[/TD]
[/TR]
[TR]
[TD]Appliance King[/TD]
[TD]4685[/TD]
[TD]01/31/14[/TD]
[TD]Net 30[/TD]
[TD]03/02/14[/TD]
[TD="align: right"]15,187.50[/TD]
[/TR]
[TR]
[TD]Appliance King[/TD]
[TD]4686[/TD]
[TD]01/31/14[/TD]
[TD]Net 30[/TD]
[TD]03/02/14[/TD]
[TD="align: right"]150.00[/TD]
[/TR]
[TR]
[TD]Atlas Plumbing[/TD]
[TD]4643[/TD]
[TD]01/16/14[/TD]
[TD]Net 30[/TD]
[TD]02/14/14[/TD]
[TD="align: right"]473.92[/TD]
[/TR]
[TR]
[TD]Atlas Plumbing[/TD]
[TD]4658[/TD]
[TD]01/22/14[/TD]
[TD]Net 30[/TD]
[TD]02/21/14[/TD]
[TD="align: right"]494.65[/TD]
[/TR]
[TR]
[TD]Atlas Plumbing[/TD]
[TD]4662[/TD]
[TD]01/23/14[/TD]
[TD]Net 30[/TD]
[TD]02/22/14[/TD]
[TD="align: right"]2,123.90[/TD]
[/TR]
</tbody>[/TABLE]
And what I want to show up on Appliance King's statement is found in the data on their two lines of the report (namely, invoices 4685 and 4686). I have, on the template statement, room for 8 invoices, so I wrote some =ISNA formulas to give a blank row for, say the 6 extra rows in this example. However, what is happening with my Vlookup is that it is bringing over the data from Appliance King's first invoice 5 times, and then on the 6th row, it brings over their second invoice. So, my statement ends up looking like this:
[TABLE="class: grid, width: 800, align: left"]
<tbody>[TR]
[TD="align: right"]Invoice #[/TD]
[TD="align: right"]Inv Date[/TD]
[TD="align: right"]Terms[/TD]
[TD="align: right"]Due Date[/TD]
[TD="align: right"]Days Late[/TD]
[TD="align: right"]Inv Amt[/TD]
[TD="align: right"]Credits[/TD]
[TD="align: right"]Inv Balance[/TD]
[TD="align: right"]Runnng Bal[/TD]
[/TR]
[TR]
[TD="align: right"]4685[/TD]
[TD="align: right"]01/31/14[/TD]
[TD="align: right"]Net 30[/TD]
[TD="align: right"]03/02/14[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]0.00[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]15,187.50[/TD]
[/TR]
[TR]
[TD="align: right"]4685[/TD]
[TD="align: right"]01/31/14[/TD]
[TD="align: right"]Net 30[/TD]
[TD="align: right"]03/02/14[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]0.00[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]30,750.00[/TD]
[/TR]
[TR]
[TD="align: right"]4685[/TD]
[TD="align: right"]01/31/14[/TD]
[TD="align: right"]Net 30[/TD]
[TD="align: right"]03/02/14[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]0.00[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]45,562.50[/TD]
[/TR]
[TR]
[TD="align: right"]4685[/TD]
[TD="align: right"]01/31/14[/TD]
[TD="align: right"]Net 30[/TD]
[TD="align: right"]03/02/14[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]0.00[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]60,750.00[/TD]
[/TR]
[TR]
[TD="align: right"]4685[/TD]
[TD="align: right"]01/31/14[/TD]
[TD="align: right"]Net 30[/TD]
[TD="align: right"]03/02/14[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]0.00[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]75,937.50[/TD]
[/TR]
[TR]
[TD="align: right"]4686[/TD]
[TD="align: right"]01/31/14[/TD]
[TD="align: right"]Net 30[/TD]
[TD="align: right"]03/02/14[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]150.00[/TD]
[TD="align: right"]0.00[/TD]
[TD="align: right"]150.00[/TD]
[TD="align: right"]76,087.50[/TD]
[/TR]
[TR]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
</tbody>[/TABLE]
So what do I need to do to change my formula so that it pulls the two invoice numbers/amounts/due dates for this customer, leaves the last 6 rows of the 8 rows blank, and doesn't repeat the first invoice 5 times?
My formula for the invoice number in the second table is: =IF(ISNA(VLOOKUP($R$6,'Revised Aged AR'!C2:E194,3,FALSE)),"",VLOOKUP($R$6,'Revised Aged AR'!C2:E194,3,FALSE)) - where R6 is the Customer Name, C2:E194 is the range of data of all customer's outstanding AR, and 3 is the column (Col E) where the invoice number is referenced on the Revised Aged AR tab. Initially, I thought this would work if I didn't "F4" the C2:E194 so that as it got copied to the next row, it would copy the next invoice referenced on the Aged AR tab (eg C3:E195). But that's illogical now that I think of it. Ideally, the C2:E194 should be $C$2:$E$194 in whatever formula works, of course. This is just how I happen to have it now.
My other formulas are basically the same, except I am doing a Vlookup of the invoice number (since those aren't duplicated) to get the invoice date, due date, terms, etc.
Lastly, I also need help with a formula that sums the invoice amounts ONLY if they fall within a certain "group" bracket (Current, >30 Days, >60 Days, >90 Days and >120 Days Past Due). I have cells at the bottom of the template that will have these group totals. So if the days late is 55 on one invoice, 59 on another, and 99 on a third, how do I get the sum to only count the two first invoices for the >30 total and the second invoice only for the 90 total?
I love this forum and already learn so much from it; hopefully I'll be able to contribute as a "problem solver" rather than a "question asker" someday!
Thanks!
Charlotte
PS No idea what tags to put here, either!
I'm a semi-advanced Excel user in that I have taught some Excel classes (on shortcuts, pivot tables, excel formulas - basic and intermediate) but I'm not so advanced that I am super familiar or comfortable using Macros (except a simple one to create a keyboard shortcut, and even then I have to Enable Macros each time I open Excel) nor am I familiar with VBA. I think this is probably just a complex formula question, but I'm stuck so I'm hoping someone can help me.
Our company's accounting software does not create AR Customer Statements correctly, so I found out that the clerks are manually typing them line by line into an Excel template and then printing them to PDF and mailing them (60-75 customers a month x 2-8 invoices each x manual calculations DAYS of work). I figured I could expedite this a bit, and I started by exporting the current report of past due invoices (with columns for "Customer Name", "Invoice Number", "Invoice Date", "Invoice Due Date", "Terms", etc.) in one Worksheet (a tab called "Revised Aged AR") and I also created a new Template Statement in a tab called "Template". Then, I took the list of all the customers on the Revise Aged AR tab and copied them into a tab called "Current AR Customers" (removing all duplicates using the Remove Duplicates command). I then created a Macro (with the help of forums like this) that copies the Template tab and creates a new tab with the name of each customer, so that the template is duplicated 60 times except the name of the current customers receiving statements are the tab names. I also put in a formula where the customer's name would appear on the statement to change the cell containing the customer's name to match the name of the tab. Here is the formula I used for that: =MID(CELL("filename",A1),FIND("]",CELL("filename",A1),1)+1,255).
So far, so good. I can use Vlookups from another tab containing Customer Names and Addresses to fill in the address cells on each customer's statement, but what I am trying to do that isn't working correctly is to pull just that customer's lines of data off the Revised Aged AR tab and have it populate the statement. For example, let's say the data on the Revised Aged AR tab looks like this:[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Customer Name[/TD]
[TD]Invoice #
[/TD]
[TD]Inv Date
[/TD]
[TD]Terms
[/TD]
[TD]Due Date
[/TD]
[TD="align: right"]Amount[/TD]
[/TR]
[TR]
[TD]All World Roofing[/TD]
[TD]4348[/TD]
[TD]06/28/13[/TD]
[TD]Net 120[/TD]
[TD]10/26/3[/TD]
[TD="align: right"]989.85[/TD]
[/TR]
[TR]
[TD]All World Roofing[/TD]
[TD]4552[/TD]
[TD]11/27/13[/TD]
[TD]Net 120[/TD]
[TD]03/27/14[/TD]
[TD="align: right"]10,500.00[/TD]
[/TR]
[TR]
[TD]Appliance King[/TD]
[TD]4685[/TD]
[TD]01/31/14[/TD]
[TD]Net 30[/TD]
[TD]03/02/14[/TD]
[TD="align: right"]15,187.50[/TD]
[/TR]
[TR]
[TD]Appliance King[/TD]
[TD]4686[/TD]
[TD]01/31/14[/TD]
[TD]Net 30[/TD]
[TD]03/02/14[/TD]
[TD="align: right"]150.00[/TD]
[/TR]
[TR]
[TD]Atlas Plumbing[/TD]
[TD]4643[/TD]
[TD]01/16/14[/TD]
[TD]Net 30[/TD]
[TD]02/14/14[/TD]
[TD="align: right"]473.92[/TD]
[/TR]
[TR]
[TD]Atlas Plumbing[/TD]
[TD]4658[/TD]
[TD]01/22/14[/TD]
[TD]Net 30[/TD]
[TD]02/21/14[/TD]
[TD="align: right"]494.65[/TD]
[/TR]
[TR]
[TD]Atlas Plumbing[/TD]
[TD]4662[/TD]
[TD]01/23/14[/TD]
[TD]Net 30[/TD]
[TD]02/22/14[/TD]
[TD="align: right"]2,123.90[/TD]
[/TR]
</tbody>[/TABLE]
And what I want to show up on Appliance King's statement is found in the data on their two lines of the report (namely, invoices 4685 and 4686). I have, on the template statement, room for 8 invoices, so I wrote some =ISNA formulas to give a blank row for, say the 6 extra rows in this example. However, what is happening with my Vlookup is that it is bringing over the data from Appliance King's first invoice 5 times, and then on the 6th row, it brings over their second invoice. So, my statement ends up looking like this:
[TABLE="class: grid, width: 800, align: left"]
<tbody>[TR]
[TD="align: right"]Invoice #[/TD]
[TD="align: right"]Inv Date[/TD]
[TD="align: right"]Terms[/TD]
[TD="align: right"]Due Date[/TD]
[TD="align: right"]Days Late[/TD]
[TD="align: right"]Inv Amt[/TD]
[TD="align: right"]Credits[/TD]
[TD="align: right"]Inv Balance[/TD]
[TD="align: right"]Runnng Bal[/TD]
[/TR]
[TR]
[TD="align: right"]4685[/TD]
[TD="align: right"]01/31/14[/TD]
[TD="align: right"]Net 30[/TD]
[TD="align: right"]03/02/14[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]0.00[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]15,187.50[/TD]
[/TR]
[TR]
[TD="align: right"]4685[/TD]
[TD="align: right"]01/31/14[/TD]
[TD="align: right"]Net 30[/TD]
[TD="align: right"]03/02/14[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]0.00[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]30,750.00[/TD]
[/TR]
[TR]
[TD="align: right"]4685[/TD]
[TD="align: right"]01/31/14[/TD]
[TD="align: right"]Net 30[/TD]
[TD="align: right"]03/02/14[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]0.00[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]45,562.50[/TD]
[/TR]
[TR]
[TD="align: right"]4685[/TD]
[TD="align: right"]01/31/14[/TD]
[TD="align: right"]Net 30[/TD]
[TD="align: right"]03/02/14[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]0.00[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]60,750.00[/TD]
[/TR]
[TR]
[TD="align: right"]4685[/TD]
[TD="align: right"]01/31/14[/TD]
[TD="align: right"]Net 30[/TD]
[TD="align: right"]03/02/14[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]0.00[/TD]
[TD="align: right"]15,187.50[/TD]
[TD="align: right"]75,937.50[/TD]
[/TR]
[TR]
[TD="align: right"]4686[/TD]
[TD="align: right"]01/31/14[/TD]
[TD="align: right"]Net 30[/TD]
[TD="align: right"]03/02/14[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]150.00[/TD]
[TD="align: right"]0.00[/TD]
[TD="align: right"]150.00[/TD]
[TD="align: right"]76,087.50[/TD]
[/TR]
[TR]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
</tbody>[/TABLE]
So what do I need to do to change my formula so that it pulls the two invoice numbers/amounts/due dates for this customer, leaves the last 6 rows of the 8 rows blank, and doesn't repeat the first invoice 5 times?
My formula for the invoice number in the second table is: =IF(ISNA(VLOOKUP($R$6,'Revised Aged AR'!C2:E194,3,FALSE)),"",VLOOKUP($R$6,'Revised Aged AR'!C2:E194,3,FALSE)) - where R6 is the Customer Name, C2:E194 is the range of data of all customer's outstanding AR, and 3 is the column (Col E) where the invoice number is referenced on the Revised Aged AR tab. Initially, I thought this would work if I didn't "F4" the C2:E194 so that as it got copied to the next row, it would copy the next invoice referenced on the Aged AR tab (eg C3:E195). But that's illogical now that I think of it. Ideally, the C2:E194 should be $C$2:$E$194 in whatever formula works, of course. This is just how I happen to have it now.
My other formulas are basically the same, except I am doing a Vlookup of the invoice number (since those aren't duplicated) to get the invoice date, due date, terms, etc.
Lastly, I also need help with a formula that sums the invoice amounts ONLY if they fall within a certain "group" bracket (Current, >30 Days, >60 Days, >90 Days and >120 Days Past Due). I have cells at the bottom of the template that will have these group totals. So if the days late is 55 on one invoice, 59 on another, and 99 on a third, how do I get the sum to only count the two first invoices for the >30 total and the second invoice only for the 90 total?
I love this forum and already learn so much from it; hopefully I'll be able to contribute as a "problem solver" rather than a "question asker" someday!
Thanks!
Charlotte
PS No idea what tags to put here, either!