Budget Array Formula lookup pulling transactions in wrong order

ExcelGrinch

New Member
Joined
Nov 22, 2018
Messages
1
Hi Excel Guru's!

I have one that I'm stuck on and hoping someone might be able to assist with..

Context:
I'm building a budget workbook, comprised of an overview and transaction sheet, the layout for which is below.

The transaction sheet is just a dump of my bank transactions and then I use Type/Subtype to assign relevant budget information.
As an aside, I have a check column which combines a few columns to validate if the transaction is unique. The caveat with this is that the Actual date and Processed date can differ on my transaction statement.

Table 'Transactions'
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Check (Used for finding duplicate transactions w/Conditional formatting)
-Open to other ideas on identifying duplicates[/TD]
[TD]Description[/TD]
[TD]Type[/TD]
[TD]Sub Type[/TD]
[TD]Amount[/TD]
[/TR]
[TR]
[TD]23/11/2018[/TD]
[TD]See below table for code[/TD]
[TD]Transfer to Savings[/TD]
[TD]Expenses[/TD]
[TD]Savings[/TD]
[TD]99[/TD]
[/TR]
[TR]
[TD]23/11/2018[/TD]
[TD]As above[/TD]
[TD]PC Parts[/TD]
[TD]Expenses[/TD]
[TD]Shopping[/TD]
[TD]88[/TD]
[/TR]
[TR]
[TD]23/11/2018[/TD]
[TD]As above[/TD]
[TD]Food[/TD]
[TD]Expenses[/TD]
[TD]Groceries[/TD]
[TD]66[/TD]
[/TR]
[TR]
[TD]24/11/2018[/TD]
[TD]As above[/TD]
[TD]Takeout[/TD]
[TD]Expenses[/TD]
[TD]Eating Out[/TD]
[TD]77[/TD]
[/TR]
</tbody>[/TABLE]

Used to check for duplicates

Code:
=IF(A1="","",TEXT(A1,"mm")
&
SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(UPPER(SUBSTITUTE(C1," ","")),"VISAPURCHASE",""),"PTYL","PTY"),":",""),"YTD","Y"),"VISA","")&F1)

On the overview sheet, I am trying to query the above table to find transactions that are between two dates, match the Type and then use Small() to grab the top (highest expense) 5.

This is the formula I am using to find the cell address of the top transaction that meets that criteria.

Used to find the highest expense within two date ranges, where the type is Expense
Code:
{=IFERROR(ADDRESS(SMALL(IF(IF((Transactions[Date]>=$F$22)*(Transactions[Date]<$G$22),Transactions[Type])="Expenses",ROW(Transactions[Amount])), ROW(1:1)),6,1,1,"[New Budget.xlsm]Transactions"),"")}

But, I have found that it is not actually sorting by size. Instead the small appears to be sorting by date, oldest to newest.
Using the below table as an example, row 4 should be row 3 and I think this has something to do with the if ranges I am using.

[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Description[/TD]
[TD]Type[/TD]
[TD]Amount[/TD]
[/TR]
[TR]
[TD]23/11/2018[/TD]
[TD]Transfer to Savings[/TD]
[TD]Savings[/TD]
[TD]99[/TD]
[/TR]
[TR]
[TD]23/11/2018[/TD]
[TD]PC Parts[/TD]
[TD]Shopping[/TD]
[TD]88[/TD]
[/TR]
[TR]
[TD]23/11/2018[/TD]
[TD]Food[/TD]
[TD]Groceries[/TD]
[TD]66[/TD]
[/TR]
[TR]
[TD]24/11/2018[/TD]
[TD]Take out[/TD]
[TD]Eating Out[/TD]
[TD]77[/TD]
[/TR]
[TR]
[TD]etc[/TD]
[TD]etc[/TD]
[TD]etc[/TD]
[TD]etc[/TD]
[/TR]
</tbody>[/TABLE]


I also tried using this formula, but found that it was matching the amount, rather than the row found by the if ranges.

Code:
=IFERROR(CELL("address",INDEX(Transactions[Amount],MATCH(SMALL(IF(IF((Transactions[Date]>=$F$22)*(Transactions[Date]<$G$22),Transactions[Type],"")="Expenses",Transactions[Amount],""),1),Transactions[Amount],0))),"")

I think I have all the pieces, but I can't seem to put them together correctly.
I am hoping someone might be able to assist with getting me over this hurdle and if a better idea to filter out duplicate transactions comes up, I would be very interested and forever grateful.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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