Sample sheet here (in sheet3): https://docs.google.com/spreadsheets/d/1hXZzwRnYpso_Q4PHd6M818oE347yRBAh9AqTLhqX8TM/edit#gid=318977824

In part 3 of Arrayformula Alternatives series of question, I still can't figure out a straightforward way of using arrayformula to do a "if condition(s) is true, previousrow++" or just a syntax to reference the previous row for calculating the current row.

Help please?

As usual, design a Arrayformula based solution that gives the same results as column B of sample sheet.

  • Allen, did my formula produce the results you wanted? It's all well and good to post questions and ask for help; but if you don't respond when people supply answers, it may be hard to find help in the future. – Erik Tyler Jan 30 at 6:12
  • Thanks Erik. You answer was good and I've accepted your answer in the 2nd question. However I still don't understand it enough to formulate my own formulars, thus the 3rd one, with 2 conditions to check. – Allen Sierra Jan 30 at 10:20
  • Allen, I don't understand what you mean by "thus the 3rd one, with 2 conditions to check." I don't see anything else here. – Erik Tyler Jan 30 at 17:31
  • I was just saying I asked the 3rd question, which as 2 conditions to check for in the array formula. The 2nd question only had 1, so the additional IF should change the formula structure a bit and there's what I'm trying to observe. – Allen Sierra Feb 1 at 11:31
  • Allen, I still do not understand you. There are no questions here or on the sheet. I see A, B and C. There are no IF statements, either. I'm going to suggest that you start a NEW post, since the answer to your original post and data (with A and B only) has been answered. I don't think I will answer future questions, because I'm afraid I'm not able to clearly understand you. Perhaps someone else will be able to. – Erik Tyler Feb 2 at 0:37

Allen, see C1 in your new sheet:

=ArrayFormula({"Result [Erik]";IF(A2:A="","",COUNTIFS(ROW(A2:A),"<="&ROW(A2:A),A2:A,2))})

This is almost a repeat of the previous formula I provided to you on the preceding sheet.

  • This works great. But I dont see pattern in the formula to plug in my conditions and parameters. I've just changed the question to "A" and "B", hopefully that helps to show the structure in your answer. – Allen Sierra Jan 30 at 10:22
  • I don't understand what you mean by "I've just changed the question to 'A' and 'B'" or by "hopefully that helps to show the structure in your answer." The only conditions and parameters we can know about here are the ones you share with us. If you set up sample data that isn't like your actual data, then we write formulas that you won't be able to use. Always set up sample data as closely to your actual data as possible. – Erik Tyler Jan 30 at 17:33
  • I just looked at your sheet again, and it looks like you've added a C in the mix. This is not like what you described in the original post or sheet. So it is actually a different question. For the sake of keeping things organized for yourself, helpers and people who may search for answers here in the future, please start a new post that accurately describes your actual need. Think ahead. If you are really going to have D and E and F added to the mix, be clear about this and about what should happen at each type of change. – Erik Tyler Jan 30 at 17:38
  • What I'm looking for is essentially a rule/structure/pattern/syntax that allows arrayformula to checks for multiple conditions (likely nested IF-ELSE, and it shouldn't matter if it's boolean/numeric/string) and produce an output that is based on the previous row's value. – Allen Sierra Feb 1 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.