79716752

Date: 2025-07-27 23:22:30
Score: 1
Natty:
Report link

Some of these questions aren't relevant - [Ticker symbol] is a native excel feature to reference a stock ticker from cell text. Can be ignored - doesn't matter to the result I'm looking for.

The below formula works, but it would be more clean (and easier to maintain) if I could remove the reference to each of the OR filter (Market buy, Limit buy, Recurring buy, Fractional buy) and instead cycle through the "buyTypes" variable. The formula within the existing REDUCE would have to change slightly to SUM the result after applying the buyTypes array within the filter function, but it should have the same results. Data within the cells and tables doesn't matter at all.

This is a working formula and the contents of the OR string in the FILTER parameters (the parts joined with + symbols) are what I want to replace:

=LET(   
   buyTypes,VSTACK("Market buy","Limit buy","Recurring buy","Fractional buy"),
   tables,VSTACK("tblTFSA","tblFHSA","tblRRSP","tblCASH","tblRAINY"),
   return,REDUCE(0,tables,LAMBDA(a,b,a+SUM(
      FILTER(INDIRECT(b&"[COST IMPACT]"),
         (INDIRECT(b&"[TICKER]")=F8.[Ticker symbol])*
         ((INDIRECT(b&"[TYPE]")="Market buy")+
          (INDIRECT(b&"[TYPE]")="Limit buy")+
          (INDIRECT(b&"[TYPE]")="Recurring buy")+
          (INDIRECT(b&"[TYPE]")="Fractional buy")),0)))),
   return)
Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Gimics