Changing formula (with consecutive relative references) into an array formula so it will work with google...





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







-1















How do I change the following formula into an array formula so it will work even when new rows are added by google forms?



=if(SUMPRODUCT($D5:$D7) < 1,"Bad","Good")


Background:
Column D contains either TRUE or FALSE values. The formula simply looks back and if there are 3 Falses in a row, I need the output to be "Bad". This works fine if I copy it down. But, this sheet is linked to a google form and google adds a new row for new responses.



For another part of the sheet I figured out that if I make an array formula, then the array formula will take effect even though google inserts a new row (no need to copy down). Example of what works: =ArrayFormula(DAY($C2:C) = $A$1). This works from $C2 all the way down the rest of column C and so works with rows inserted by google forms.



How can I make the first formula work like the second while still looking back at the last three relative values?










share|improve this question































    -1















    How do I change the following formula into an array formula so it will work even when new rows are added by google forms?



    =if(SUMPRODUCT($D5:$D7) < 1,"Bad","Good")


    Background:
    Column D contains either TRUE or FALSE values. The formula simply looks back and if there are 3 Falses in a row, I need the output to be "Bad". This works fine if I copy it down. But, this sheet is linked to a google form and google adds a new row for new responses.



    For another part of the sheet I figured out that if I make an array formula, then the array formula will take effect even though google inserts a new row (no need to copy down). Example of what works: =ArrayFormula(DAY($C2:C) = $A$1). This works from $C2 all the way down the rest of column C and so works with rows inserted by google forms.



    How can I make the first formula work like the second while still looking back at the last three relative values?










    share|improve this question



























      -1












      -1








      -1








      How do I change the following formula into an array formula so it will work even when new rows are added by google forms?



      =if(SUMPRODUCT($D5:$D7) < 1,"Bad","Good")


      Background:
      Column D contains either TRUE or FALSE values. The formula simply looks back and if there are 3 Falses in a row, I need the output to be "Bad". This works fine if I copy it down. But, this sheet is linked to a google form and google adds a new row for new responses.



      For another part of the sheet I figured out that if I make an array formula, then the array formula will take effect even though google inserts a new row (no need to copy down). Example of what works: =ArrayFormula(DAY($C2:C) = $A$1). This works from $C2 all the way down the rest of column C and so works with rows inserted by google forms.



      How can I make the first formula work like the second while still looking back at the last three relative values?










      share|improve this question
















      How do I change the following formula into an array formula so it will work even when new rows are added by google forms?



      =if(SUMPRODUCT($D5:$D7) < 1,"Bad","Good")


      Background:
      Column D contains either TRUE or FALSE values. The formula simply looks back and if there are 3 Falses in a row, I need the output to be "Bad". This works fine if I copy it down. But, this sheet is linked to a google form and google adds a new row for new responses.



      For another part of the sheet I figured out that if I make an array formula, then the array formula will take effect even though google inserts a new row (no need to copy down). Example of what works: =ArrayFormula(DAY($C2:C) = $A$1). This works from $C2 all the way down the rest of column C and so works with rows inserted by google forms.



      How can I make the first formula work like the second while still looking back at the last three relative values?







      google-sheets array-formulas google-sheets-formula






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 24 '18 at 1:04









      Rubén

      11.4k53670




      11.4k53670










      asked Nov 23 '18 at 12:17









      silent_johnsilent_john

      123




      123
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Well the direct equivalent would be



          =ArrayFormula(if(A4:A="","",A4:A+A3:A+A2:A))


          but this doesn't work - it will always need more rows to be inserted at the bottom of the sheet.



          =ArrayFormula(if(A4:A="","",A4:A+A3:A999+A2:A998))


          does work, but only for a certain sheet size.



          You could look ahead like this though:



          ArrayFormula(if(A2:A="","",A2:A+A3:A+A4:A))


          A more complicated way to get round it is to do a vlookup on the row number like this:



          =ArrayFormula(if(row(A2:A)<4,"",if(A2:A="","",A2:A+vlookup(row(A2:A)-2,{row(A2:A),A2:A},2,false)+vlookup(row(A2:A)-1,{row(A2:A),A2:A},2,false))))


          (you need to add if statements to make it report "Good" or "Bad")



          =ArrayFormula(if(row(A2:A)<4,"",if(A2:A="","",IF(A2:A+vlookup(row(A2:A)-2,{row(A2:A),A2:A},2,false)+vlookup(row(A2:A)-1,{row(A2:A),A2:A},2,false),"Good","Bad"))))





          share|improve this answer


























          • Actually your first version fixed my problem. I only ever use this with google form responses so google is always inserting a row at the bottom of the sheet for a new response. Your first solution works great for me.

            – silent_john
            Nov 24 '18 at 7:50












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53446583%2fchanging-formula-with-consecutive-relative-references-into-an-array-formula-so%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Well the direct equivalent would be



          =ArrayFormula(if(A4:A="","",A4:A+A3:A+A2:A))


          but this doesn't work - it will always need more rows to be inserted at the bottom of the sheet.



          =ArrayFormula(if(A4:A="","",A4:A+A3:A999+A2:A998))


          does work, but only for a certain sheet size.



          You could look ahead like this though:



          ArrayFormula(if(A2:A="","",A2:A+A3:A+A4:A))


          A more complicated way to get round it is to do a vlookup on the row number like this:



          =ArrayFormula(if(row(A2:A)<4,"",if(A2:A="","",A2:A+vlookup(row(A2:A)-2,{row(A2:A),A2:A},2,false)+vlookup(row(A2:A)-1,{row(A2:A),A2:A},2,false))))


          (you need to add if statements to make it report "Good" or "Bad")



          =ArrayFormula(if(row(A2:A)<4,"",if(A2:A="","",IF(A2:A+vlookup(row(A2:A)-2,{row(A2:A),A2:A},2,false)+vlookup(row(A2:A)-1,{row(A2:A),A2:A},2,false),"Good","Bad"))))





          share|improve this answer


























          • Actually your first version fixed my problem. I only ever use this with google form responses so google is always inserting a row at the bottom of the sheet for a new response. Your first solution works great for me.

            – silent_john
            Nov 24 '18 at 7:50
















          0














          Well the direct equivalent would be



          =ArrayFormula(if(A4:A="","",A4:A+A3:A+A2:A))


          but this doesn't work - it will always need more rows to be inserted at the bottom of the sheet.



          =ArrayFormula(if(A4:A="","",A4:A+A3:A999+A2:A998))


          does work, but only for a certain sheet size.



          You could look ahead like this though:



          ArrayFormula(if(A2:A="","",A2:A+A3:A+A4:A))


          A more complicated way to get round it is to do a vlookup on the row number like this:



          =ArrayFormula(if(row(A2:A)<4,"",if(A2:A="","",A2:A+vlookup(row(A2:A)-2,{row(A2:A),A2:A},2,false)+vlookup(row(A2:A)-1,{row(A2:A),A2:A},2,false))))


          (you need to add if statements to make it report "Good" or "Bad")



          =ArrayFormula(if(row(A2:A)<4,"",if(A2:A="","",IF(A2:A+vlookup(row(A2:A)-2,{row(A2:A),A2:A},2,false)+vlookup(row(A2:A)-1,{row(A2:A),A2:A},2,false),"Good","Bad"))))





          share|improve this answer


























          • Actually your first version fixed my problem. I only ever use this with google form responses so google is always inserting a row at the bottom of the sheet for a new response. Your first solution works great for me.

            – silent_john
            Nov 24 '18 at 7:50














          0












          0








          0







          Well the direct equivalent would be



          =ArrayFormula(if(A4:A="","",A4:A+A3:A+A2:A))


          but this doesn't work - it will always need more rows to be inserted at the bottom of the sheet.



          =ArrayFormula(if(A4:A="","",A4:A+A3:A999+A2:A998))


          does work, but only for a certain sheet size.



          You could look ahead like this though:



          ArrayFormula(if(A2:A="","",A2:A+A3:A+A4:A))


          A more complicated way to get round it is to do a vlookup on the row number like this:



          =ArrayFormula(if(row(A2:A)<4,"",if(A2:A="","",A2:A+vlookup(row(A2:A)-2,{row(A2:A),A2:A},2,false)+vlookup(row(A2:A)-1,{row(A2:A),A2:A},2,false))))


          (you need to add if statements to make it report "Good" or "Bad")



          =ArrayFormula(if(row(A2:A)<4,"",if(A2:A="","",IF(A2:A+vlookup(row(A2:A)-2,{row(A2:A),A2:A},2,false)+vlookup(row(A2:A)-1,{row(A2:A),A2:A},2,false),"Good","Bad"))))





          share|improve this answer















          Well the direct equivalent would be



          =ArrayFormula(if(A4:A="","",A4:A+A3:A+A2:A))


          but this doesn't work - it will always need more rows to be inserted at the bottom of the sheet.



          =ArrayFormula(if(A4:A="","",A4:A+A3:A999+A2:A998))


          does work, but only for a certain sheet size.



          You could look ahead like this though:



          ArrayFormula(if(A2:A="","",A2:A+A3:A+A4:A))


          A more complicated way to get round it is to do a vlookup on the row number like this:



          =ArrayFormula(if(row(A2:A)<4,"",if(A2:A="","",A2:A+vlookup(row(A2:A)-2,{row(A2:A),A2:A},2,false)+vlookup(row(A2:A)-1,{row(A2:A),A2:A},2,false))))


          (you need to add if statements to make it report "Good" or "Bad")



          =ArrayFormula(if(row(A2:A)<4,"",if(A2:A="","",IF(A2:A+vlookup(row(A2:A)-2,{row(A2:A),A2:A},2,false)+vlookup(row(A2:A)-1,{row(A2:A),A2:A},2,false),"Good","Bad"))))






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 23 '18 at 17:10

























          answered Nov 23 '18 at 14:12









          Tom SharpeTom Sharpe

          13.3k31227




          13.3k31227













          • Actually your first version fixed my problem. I only ever use this with google form responses so google is always inserting a row at the bottom of the sheet for a new response. Your first solution works great for me.

            – silent_john
            Nov 24 '18 at 7:50



















          • Actually your first version fixed my problem. I only ever use this with google form responses so google is always inserting a row at the bottom of the sheet for a new response. Your first solution works great for me.

            – silent_john
            Nov 24 '18 at 7:50

















          Actually your first version fixed my problem. I only ever use this with google form responses so google is always inserting a row at the bottom of the sheet for a new response. Your first solution works great for me.

          – silent_john
          Nov 24 '18 at 7:50





          Actually your first version fixed my problem. I only ever use this with google form responses so google is always inserting a row at the bottom of the sheet for a new response. Your first solution works great for me.

          – silent_john
          Nov 24 '18 at 7:50




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53446583%2fchanging-formula-with-consecutive-relative-references-into-an-array-formula-so%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

          Alcedinidae

          RAC Tourist Trophy