The first one works perfect, and it is good for me.
May I challenge you with a more complex issue.
In the formula I add here, the One_unit works perfect, but the All_unit gives me the "calc" error.
Any suggested solution?
=LET(
Main_unit_row,MATCH($A$2,parameters!$A$16:$A$61,0)+15,
Main_next_unit_name,INDEX(parameters!$A$3:$F$3,MATCH($A$2,parameters!$A$3:$F$3,0)+1),
Main_next_unit_row,MATCH(Main_next_unit_name,parameters!$A$16:$A$61,0)+15,
Unit_row,MATCH($B$2,parameters!$B$17:$B$52,0)+16,
Saif_col,Total_sheet!$D:$D,
Unit_seifim_all,INDIRECT("parameters!$d"&Main_unit_row&":$o"&Main_next_unit_row),
Unit_seifim1,INDIRECT("parameters!$d"&Unit_row&":$o"&Unit_row),
All_unit,FILTER(FILTER(Total_sheet!$A:$E,ISNUMBER(MATCH(Saif_col,Unit_seifim_all,0))),{1,1,1,1,1}),
One_unit,FILTER(FILTER(Total_sheet!$A:$E,ISNUMBER(MATCH(Saif_col,Unit_seifim1,0))),{1,1,1,1,1}),
IF($B$2="all",All_unit,One_unit))
I know you prefer to see the file, but I have a problem to load it here, sorry.
and thx again,
Nati