Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
oana89
Femeie
25 ani
Bucuresti
cauta Barbat
25 - 46 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] LAMBDA Function to Repeat Array or Items in Array Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
Mrrrr
AdMiN

Inregistrat: acum 18 ani
Postari: 2308
REPEAT ARRAY/RANGE OR ITEMS IN ARRAY/RANGE A GIVEN NUMBER OF TIMES

key words: REPEAT range array LAMBDA MAKEARRAY INDEX SEQUENCE

Array can be either set manually within the function, or you can add a range (even spill range).

LAMBDA to add into Name Manager:

=LAMBDA(array;times_to_repeat;[repeat_type_1_for_each_2_for_all];
    IF(OR(times_to_repeat<1; MOD(times_to_repeat;1)<>0);
        "Error: times_to_repeat must be a positive whole number";
        IF(OR(repeat_type_1_for_each_2_for_all=1;ISOMITTED(repeat_type_1_for_each_2_for_all));
            INDEX(array; ROUNDUP(SEQUENCE(COUNTA(array)*times_to_repeat)/times_to_repeat;0));
            LET(
               rows; ROWS(array);
               cols; COLUMNS(array);
               MAKEARRAY(rows*times_to_repeat; cols;
                   LAMBDA(r;c;
                      INDEX(array; MOD(r-1; rows)+1; c)
                   )
              )
            )
        )
    )
)

USAGE:

=REPEAT(A1; 3; 1)
=REPEAT(A1:A3; 3; 2)
=REPEAT(A1#; 3; 1)
=REPEAT({"Andrei"; "Cristina"; "Tudor"}; 3; 2)

SYNTAX:

=REPEAT(array; times_to_repeat; [repeat_type_1_for_each_2_for_all])

Let's assume in cells A1:A3 we have and we want to repeat them 3 times:
Andrei
Cristina
Tudor

array = what you want to repeat, can be:
- a cell: A1
- a range of cells: A1:A3
- a spilled array: A1#
- an array fed directly into the formula with curly brackets: {"Andrei"; "Cristina"; "Tudor"}

times_to_repeat = must be a positive whole number, e.g., 3, 10, 28, etc.

[repeat_type_1_for_each_2_for_all] = optional, can be:
- 1 to repeat each item times_to_repeat times:
Andrei
Andrei
Andrei
Cristina
Cristina
Cristina
Tudor
Tudor
Tudor

- 2 to repeat all items times_to_repeat times
Andrei
Cristina
Tudor
Andrei
Cristina
Tudor
Andrei
Cristina
Tudor

- if omitted, it does the same as if you type 1


Source:
A part of it was made with ChatGPT


_______________________________________


pus acum 9 zile
   
Pagini: 1  

Mergi la