Home > Software design >  How to convert this formula into an arrayformula? Google Sheets
How to convert this formula into an arrayformula? Google Sheets

Time:12-04

Been beating my head against this and can't get it. Here is the forumla:

=IF(E3=E2,F2,F2 1)

Pretty simple. All it does is look at the cell above it...if they are the same it doesn't increase the number iteration. If they are different it does. Somehow I can't figure out how to format this in order to make it an ArrayFormula. The only reason I want it to be an Arrayformula is so that rows can be added or removed and the formula would remain intact thus the spreadsheet would be easier to use.

CodePudding user response:

To turn this formula into an array formula, you need to enclose it in ARRAYFORMULA and press Ctrl Shift Enter (on Windows) or Cmd Shift Enter (on Mac) to enter the formula. Here's what the resulting array formula would look like:

=ARRAYFORMULA(IF(E3:E=E2:E,F2:F,F2:F 1))

The ARRAYFORMULA function allows you to apply a formula to a range of cells at once, so when you add or remove rows, the formula will automatically be applied to the new or remaining cells in the range.

Note that when you enter an array formula, you need to press Ctrl Shift Enter (on Windows) or Cmd Shift Enter (on Mac) to enter the formula. This will cause the formula to be surrounded by {} brackets, which indicates that it is an array formula.

CodePudding user response:

If you need to place it in column F from F3, you may try another approach or you'll get a circular dependency:

=BYROW(E3:E,LAMBDA(each,IF(each="","",F2 sum(MAP(E3:each, LAMBDA(c,IF(c="","",IF(c=OFFSET(c,-1,),0,1))))))))

CodePudding user response:

try:

=INDEX(BYROW(E2:INDEX(E:E, MAX(ROW(E:E)*(E:E<>""))), 
 LAMBDA(e, IF(OFFSET(e, 1, )=e, OFFSET(e,,1), OFFSET(e,,1) 1))
  • Related