Skip to content

Instantly share code, notes, and snippets.

@ExcelExciting
Last active June 15, 2023 09:28
Show Gist options
  • Save ExcelExciting/6790576da8916cbba5ab19675957791e to your computer and use it in GitHub Desktop.
Save ExcelExciting/6790576da8916cbba5ab19675957791e to your computer and use it in GitHub Desktop.
Lambda - 00002 - STACKDATA
STACKDATA =
/*Stacking you data one upon another selected range.
YouTube Link: https://youtu.be/LyAY7WNpIKQ
SYNTAX:
=STACKDATA(DataRange,[Data_Orientation],[Transpose_Data])
+Name+Company+
+Faraz+Microsoft+
+Nisha+Apple+
 
RESULT01>> =STACKDATA(DataRange,0)
Faraz
Microsoft
Nisha
Apple
 
RESULT02>> =STACKDATA(DataRange,1,1)
Faraz Nisha Microsoft Apple
 
author,"Faraz Shaikh, Microsoft® MVP",
wesite,"www.ExcelExciting.com",
Created,"20220312",
Modified,"20220316"*/
 
LAMBDA( v_Selected_Range,
        [v_Selected_Option],
        [v_Transpose],
    LET(
        v_Columns,COLUMNS(v_Selected_Range),
        v_Rows,ROWS(v_Selected_Range),
        v_RxC,v_Rows * v_Columns,
 
        v_Seq,SEQUENCE(v_RxC,,0),
        v_seq_columns,MOD(v_Seq,v_Columns)+1,
        v_seq_rows,QUOTIENT(v_Seq,v_Columns)+1,       
       
        v_seq_rows_h,MOD(v_Seq,v_Rows)+1,
        v_seq_columns_h,QUOTIENT(v_Seq,v_Rows)+1,       
 
        output1,INDEX(v_Selected_Range,v_seq_rows,v_seq_columns),
        output2,INDEX(v_Selected_Range,v_seq_rows_h,v_seq_columns_h),
 
       
        v_Selected_Option_Logic,
        IF(v_Selected_Option=0,output1,output2
        ),
 
        v_Transpose_Logic,
        IF( ISOMITTED(v_Transpose),v_Selected_Option_Logic,
            IF(v_Transpose=1,
            TRANSPOSE(v_Selected_Option_Logic),
            v_Selected_Option_Logic
            )
        ),
 
        result,v_Transpose_Logic,
        result
    )
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment