SUM results of CHOOSECOLS with FILTER for multiple criteria

xcelnovice101

Active Member
Joined
Aug 24, 2012
Messages
368
I have a structured table [Trades] with column headers Trade_Date, Payment_Date, Code, Amount. I want to sum all amounts where Code = "GenCost" and Payment_Date = Payment_Date when the Trade_Date equals 8/2/23 for example and the Code = "Dividend". This might seem contradictory on the face of it but when the Code = "Dividend" the Payment_Date is always after/greater the Trade_Date. When the Code = GenCost the Trade_Date = Payment_Date. There may be multiple rows for such criteria which is why I'm trying to sum to a single figure. Ultimately I just want -4,312.56 for date 8/2/2023 in this example. I can't figure out how to write a formula that takes the step-wise conditions; I believe excel is taking my inputs as contradictory.

Trade_DatePayment_DateCodeAmount
8/2/2023​
9/5/2023​
Dividend193,116.60
9/5/2023​
9/5/2023​
GenCost(4,312.56)

Here is my formula (I probably don't need the Unique function because I haven't seen any duplicates):
Excel Formula:
UNIQUE(CHOOSECOLS(FILTER(Trades[[Trade_Date]:[Amount],Trades[Code]="GenCost")*(Trades[Payment_Date]=Trades[Payment_Date])*(Trades[Trade_Date]=8/2/2023)*(Trades[Code]="Dividend")*(Trades[Amount]),-1),FALSE,FALSE)

Would I be better off doing a SUMPRODUCT(IF(
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,224,747
Messages
6,180,719
Members
452,995
Latest member
isldboy

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