Lookup and Matching Invoices

yoosh

New Member
Joined
Jan 26, 2022
Messages
5
Office Version
  1. 2013
Platform
  1. Windows
Hi everyone!

Excel version: 2013

I am using Excel to keep a checkbook of my workplace, specifically for tracking expenses.

I am trying to figure out a formula that will pull invoice data based on a cell I have that has the current month in it (January). I have three different worksheets - Operating Expenses, Admin Expenses, and Advertising Expenses. Each of the invoices are broken up into spend categories such as cleaning supplies, uniforms, internet, etc.

I have all of my invoices on one worksheet with the following data in columns - invoice date, spend category, and details.

I would like the formula to match the invoice dates and spend categories for the current month (which is picked by a drop-down cell), but I only want to pull the invoices for the spend categories on that worksheet (operating expenses only, for example).

I've attached an example of the Operating Expenses worksheet. The other worksheets look very similar with different spend categories at the top.

Thank you so much for your help. I've spent so much time on this spreadsheet but am limited because of my excel knowledge.
 

Attachments

  • example.PNG
    example.PNG
    14.3 KB · Views: 14

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Hi Yoosh,

You will also need the year (which I added as a dropdown) otherwise your numbers won't work over year end.

I didn't see a value mentioned on the Invoices so I've added that as column D.

Is this what you wanted?

Yoosh.xlsx
ABCD
1Invoice DateSpend CategoryDetailsValue
201-Jan-21Cleaning SuppliesRags$1,200.00
307-Feb-21UniformsDickies$3,200.00
409-Feb-21InternetAT&T$400.00
511-Feb-21WagesLess O/T$23,000.00
613-Feb-21PhoneAT&T$750.00
715-Feb-21BribePhebius Project$50,000.00
817-Feb-21Hitman ContractCEO Phebius$120,000.00
918-Feb-21Blackmail paymentWitness$35,000.00
1019-Feb-21Cleaning SuppliesRags$1,200.00
1120-Feb-21UniformsDickies$3,200.00
1221-Feb-21InternetAT&T$400.00
1322-Feb-21WagesLess O/T$23,000.00
1422-Feb-21WagesO/T$8,500.00
1523-Feb-21PhoneAT&T$750.00
1624-Feb-21BribePhebius CFO$88,000.00
1703-Mar-21BribePhebius CIO$98,000.00
Invoices


Cell Formulas
RangeFormula
C2C2=DATE($D$1,MATCH($C$1,{"January","February","March","April","May","June","July","August","September","October","November","December"},0),1)
E4:I4E4=SUM(E$5:E$9999)
E5:I15E5=IFERROR(IF(E$1=INDEX(Invoices!$B$2:$B$9999,AGGREGATE(15,6,ROW(Invoices!$A$2:$A$9999)-ROW(Invoices!$A$1)/((Invoices!$A$2:$A$9999>=$C$2)*(Invoices!$A$2:$A$9999<=EOMONTH($C$2,0))*(NOT(ISNA(MATCH(Invoices!$B$2:$B$9999,$E$1:$I$1,0))))),ROW()-ROW($A$4))),INDEX(Invoices!$D$2:$D$9999,AGGREGATE(15,6,ROW(Invoices!$A$2:$A$9999)-ROW(Invoices!$A$1)/((Invoices!$A$2:$A$9999>=$C$2)*(Invoices!$A$2:$A$9999<=EOMONTH($C$2,0))*(NOT(ISNA(MATCH(Invoices!$B$2:$B$9999,$E$1:$I$1,0))))),ROW()-ROW($A$4))),""),"")
A5:C15A5=IFERROR(INDEX(Invoices!A$2:A$9999,AGGREGATE(15,6,ROW(Invoices!$A$2:$A$9999)-ROW(Invoices!$A$1)/((Invoices!$A$2:$A$9999>=$C$2)*(Invoices!$A$2:$A$9999<=EOMONTH($C$2,0))*(NOT(ISNA(MATCH(Invoices!$B$2:$B$9999,$E$1:$I$1,0))))),ROW()-ROW($A$4))),"")
Cells with Data Validation
CellAllowCriteria
C1ListJanuary,February,March,April,May,June,July,August,September,October,November,December
D1List2018,2019,2020,2021,2022,2023,2024,2025
 
Upvote 0
Hey! Thank you so much!

The formula is not working for me. Does it matter which order the columns are in? Specifically in the invoice worksheet?
 
Upvote 0
Yes, of course. You didn't say what the format was so I went with
1643297264631.png


If you give me your format I can amend as necessary.
 
Upvote 0
Thank you so much Toadstool!! The formula works now. The only issue I have now is that the start date of the month periods are not actually the first of the month. For example, there are some days in February that run on the January accounting period. How do I fix the formula to account for this?
 
Upvote 0
Do you have a table of the dates/Accounting Periods?
Please supply that table or the mechanism you use to calculate Accounting Period.
 
Upvote 0
Do you have a table of the dates/Accounting Periods?
Please supply that table or the mechanism you use to calculate Accounting Period.

Hi sorry for the delay. I had to wait until today to get the correct information from accounting.

The following table has out accounting periods.

MonthFirst Day of Month*Month-End Date*Number of Weeks
January01/03/2201/30/224
February01/31/2202/27/224
March02/28/2204/03/225
April04/04/2205/01/224
May05/02/2205/29/224
June05/30/2207/03/225
July07/04/2207/31/224
August08/01/2208/28/224
September08/29/2210/02/225
October10/03/2210/30/224
November10/31/2211/27/224
December11/28/2201/01/235
 
Upvote 0
So I've added the accounting periods table as a new sheet "ACPeriods"

Yoosh2.xlsx
ABCD
1MonthFirst Day of Month*Month-End Date*Number of Weeks
2
3January03-Jan-2230-Jan-224
4February31-Jan-2227-Feb-224
5March28-Feb-2203-Apr-225
6April04-Apr-2201-May-224
7May02-May-2229-May-224
8June30-May-2203-Jul-225
9July04-Jul-2231-Jul-224
10August01-Aug-2228-Aug-224
11September29-Aug-2202-Oct-225
12October03-Oct-2230-Oct-224
13November31-Oct-2227-Nov-224
14December28-Nov-2201-Jan-235
ACPeriods


I updated my Invoices to be 2022 dates

Yoosh2.xlsx
ABCD
1Invoice DateSpend CategoryDetailsValue
201-Jan-22Cleaning SuppliesRags$1,200.00
331-Jan-22Cleaning SuppliesBleach$125.00
407-Feb-22UniformsDickies$3,200.00
509-Feb-22InternetAT&T$400.00
611-Feb-22WagesLess O/T$23,000.00
713-Feb-22PhoneAT&T$750.00
815-Feb-22BribePhebius Project$50,000.00
917-Feb-22Hitman ContractCEO Phebius$120,000.00
1018-Feb-22Blackmail paymentWitness$35,000.00
1119-Feb-22Cleaning SuppliesRags$1,200.00
1220-Feb-22UniformsDickies$3,200.00
1322-Feb-22InternetAT&T$400.00
1422-Feb-22WagesLess O/T$23,000.00
1522-Feb-22WagesO/T$8,500.00
1623-Feb-22PhoneAT&T$750.00
1724-Feb-22BribePhebius CFO$88,000.00
1803-Mar-22BribePhebius CIO$98,000.00
19
Invoices


Here's the revised Operating Expense sheet

Cell Formulas
RangeFormula
E4:I4E4=SUM(E$5:E$9999)
E5:I16E5=IFERROR(IF(E$1=INDEX(Invoices!$B$2:$B$9999,AGGREGATE(15,6,ROW(Invoices!$A$2:$A$9999)-ROW(Invoices!$A$1)/((Invoices!$A$2:$A$9999>=INDEX(ACPeriods!$B$3:$B$14,MATCH($C$1,ACPeriods!$A$3:$A$14,0)))*(Invoices!$A$2:$A$9999<=INDEX(ACPeriods!$C$3:$C$14,MATCH($C$1,ACPeriods!$A$3:$A$14,0)))*(NOT(ISNA(MATCH(Invoices!$B$2:$B$9999,$E$1:$I$1,0))))),ROW()-ROW($A$4))),INDEX(Invoices!$D$2:$D$9999,AGGREGATE(15,6,ROW(Invoices!$A$2:$A$9999)-ROW(Invoices!$A$1)/((Invoices!$A$2:$A$9999>=INDEX(ACPeriods!$B$3:$B$14,MATCH($C$1,ACPeriods!$A$3:$A$14,0)))*(Invoices!$A$2:$A$9999<=INDEX(ACPeriods!$C$3:$C$14,MATCH($C$1,ACPeriods!$A$3:$A$14,0)))*(NOT(ISNA(MATCH(Invoices!$B$2:$B$9999,$E$1:$I$1,0))))),ROW()-ROW($A$4))),""),"")
A5:C16A5=IFERROR(INDEX(Invoices!A$2:A$9999,AGGREGATE(15,6,ROW(Invoices!$A$2:$A$9999)-ROW(Invoices!$A$1)/((Invoices!$A$2:$A$9999>=INDEX(ACPeriods!$B$3:$B$14,MATCH($C$1,ACPeriods!$A$3:$A$14,0)))*(Invoices!$A$2:$A$9999<=INDEX(ACPeriods!$C$3:$C$14,MATCH($C$1,ACPeriods!$A$3:$A$14,0)))*(NOT(ISNA(MATCH(Invoices!$B$2:$B$9999,$E$1:$I$1,0))))),ROW()-ROW($A$4))),"")
Cells with Data Validation
CellAllowCriteria
C1ListJanuary,February,March,April,May,June,July,August,September,October,November,December
 
Upvote 0
Do I not need the drop box for the year any more? I guess I could just make a new spreadsheet for next year.
 
Upvote 0
Do I not need the drop box for the year any more? I guess I could just make a new spreadsheet for next year.
Your ACPeriods are specific to a year so "January" can only mean January 2022.

If you want it to be more flexible, and handle 2021, then I suggest you have Accounting supply the 2021 periods and embed the financial year in the month selection dropdown. That would look something like this (Note: My 2021 dates are fictitious, of course).

Yoosh3.xlsx
ABC
1MonthFirst Day of Month*Month-End Date*
2
3January FY2103-Jan-2130-Jan-21
4February FY2131-Jan-2127-Feb-21
5March FY2128-Feb-2103-Apr-21
6April FY2104-Apr-2101-May-21
7May FY2102-May-2129-May-21
8June FY2130-May-2103-Jul-21
9July FY2104-Jul-2131-Jul-21
10August FY2101-Aug-2128-Aug-21
11September FY2129-Aug-2102-Oct-21
12October FY2103-Oct-2130-Oct-21
13November FY2131-Oct-2127-Nov-21
14December FY2128-Nov-2101-Jan-22
15January FY2203-Jan-2230-Jan-22
16February FY2231-Jan-2227-Feb-22
17March FY2228-Feb-2203-Apr-22
18April FY2204-Apr-2201-May-22
19May FY2202-May-2229-May-22
20June FY2230-May-2203-Jul-22
21July FY2204-Jul-2231-Jul-22
22August FY2201-Aug-2228-Aug-22
23September FY2229-Aug-2202-Oct-22
24October FY2203-Oct-2230-Oct-22
25November FY2231-Oct-2227-Nov-22
26December FY2228-Nov-2201-Jan-23
27
ACPeriods


Then the Operating Expense sheet changes to this:

Cell Formulas
RangeFormula
E4:I4E4=SUM(E$5:E$9999)
E5:I16E5=IFERROR(IF(E$1=INDEX(Invoices!$B$2:$B$9999,AGGREGATE(15,6,ROW(Invoices!$A$2:$A$9999)-ROW(Invoices!$A$1)/((Invoices!$A$2:$A$9999>=INDEX(ACPeriods!$B$3:$B$51,MATCH($C$1,ACPeriods!$A$3:$A$51,0)))*(Invoices!$A$2:$A$9999<=INDEX(ACPeriods!$C$3:$C$51,MATCH($C$1,ACPeriods!$A$3:$A$51,0)))*(NOT(ISNA(MATCH(Invoices!$B$2:$B$9999,$E$1:$I$1,0))))),ROW()-ROW($A$4))),INDEX(Invoices!$D$2:$D$9999,AGGREGATE(15,6,ROW(Invoices!$A$2:$A$9999)-ROW(Invoices!$A$1)/((Invoices!$A$2:$A$9999>=INDEX(ACPeriods!$B$3:$B$51,MATCH($C$1,ACPeriods!$A$3:$A$51,0)))*(Invoices!$A$2:$A$9999<=INDEX(ACPeriods!$C$3:$C$51,MATCH($C$1,ACPeriods!$A$3:$A$51,0)))*(NOT(ISNA(MATCH(Invoices!$B$2:$B$9999,$E$1:$I$1,0))))),ROW()-ROW($A$4))),""),"")
A5:C16A5=IFERROR(INDEX(Invoices!A$2:A$9999,AGGREGATE(15,6,ROW(Invoices!$A$2:$A$9999)-ROW(Invoices!$A$1)/((Invoices!$A$2:$A$9999>=INDEX(ACPeriods!$B$3:$B$51,MATCH($C$1,ACPeriods!$A$3:$A$51,0)))*(Invoices!$A$2:$A$9999<=INDEX(ACPeriods!$C$3:$C$51,MATCH($C$1,ACPeriods!$A$3:$A$51,0)))*(NOT(ISNA(MATCH(Invoices!$B$2:$B$9999,$E$1:$I$1,0))))),ROW()-ROW($A$4))),"")
Cells with Data Validation
CellAllowCriteria
C1List=ACPeriods!$A$3:$A$51
 
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,535
Members
449,037
Latest member
tmmotairi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top