Forum Discussion

FloydGlenn's avatar
FloydGlenn
Copper Contributor
Mar 20, 2023
Solved

Dynamic array sumifs 0's till last row won't work



Having this error with a choose method i usually use to fill down text in a zero index dynamic array

This example is a project capital budgeting tool that will take some inputs derived from the user on sheets 'inputs' and b10 is = 9 

therefore 9 + 1 starting at 0 should be 9 but is 10 spaces leaving the first row for initial investment 

The reason i need to carry through values to the last row is the include in the lambda of another set of fields to get total cashflows, depreciations, etc 

I just can't seem to target the right rows, in this instance the last; the next the first four; the next the last 8  


I very well could need additional help after this first one is implemented with the latter two but for now lets fix this one to show the -15500 of change to NOWC in the Final period either given the users input of 9 (really 10 periods including initial Investment) 

I tried for hours combining sumifs and so on and couldn't do it and landed on all zeros and thought i'd stop by 😄

I included the workbook so far for reference as well as a screencap

please remember this must be dynamic based on the users inputs infact the inputs sheet has the -15500 in change to NOWC recorded on the other sheet. 

Point being the users will simply estimate and load to a sharepoint and it triggers a run to the warehouse and users can compare the likelihood get out different probabilities and valuation to compare to.

This should speed up alot imo around incresing efficiency at scale on capital and time

Thank you,
Regards

AG

  • FloydGlenn 

     

    I'm also very unclear as to what you require. Do these help?

     

    =VSTACK(SEQUENCE(A1,,0,0),A2)

    or

    =IF(SEQUENCE(A1+1,,A1,-1),0,A2)

     

    where A1 and A1 contain 9 and -15500 respectively.

3 Replies

  • Patrick2788's avatar
    Patrick2788
    Silver Contributor
    It's not clear what the expected results are supposed to be. If you're not able to attach workbooks, you may provide a link to OneDrive or another file host.
    • FloydGlenn's avatar
      FloydGlenn
      Copper Contributor

      Expected result is as follows
      0
      0
      0
      0
      0
      0
      0
      0
      0
      -15500

      Based on the input or the dynamic array input built upon it.

      In this case it was 9 so it should produce 9 sequential 0's followed by the -15500

      this will get me out the last pieces i need before i have to tackle my next problem the formula i tried is

      =CHOOSE({1,2},A4#,SUMIF(P2,TAKE(A4#,,-1))


      Where  A4#

      IS 

      =SEQUENCE(inputs[9]+1,1,0,1)


      This is my most recent of 10 different variants of dynamic arrays i've tried to get SOME input to end up at a given row number essentially. not just the last one but any of them or a series of periods rather is the greater issue

      • JosWoolley's avatar
        JosWoolley
        Iron Contributor

        FloydGlenn 

         

        I'm also very unclear as to what you require. Do these help?

         

        =VSTACK(SEQUENCE(A1,,0,0),A2)

        or

        =IF(SEQUENCE(A1+1,,A1,-1),0,A2)

         

        where A1 and A1 contain 9 and -15500 respectively.

Resources