Forum Discussion

boukasa's avatar
boukasa
Brass Contributor
Dec 12, 2021

Filter an array row-by-row, or sort row-by-row

How can an array be filtered row by row?

 

I have an array that has names and FALSE as entries. I'm trying to remove the FALSE entries. FILTER does not appear to let me work each row separately, and LAMBDA does not allow output of an array, only a scalar.

 

I'm looking for an array solution, not a copy-down.

 

Is this possible?

 

I've attached an example.

 

(I truly am mystified by the FILTER function's behavior with array parameters. A single row works fine - FILTER(onerowarray,onerowarray<>FALSE) - but multiple rows produce #VALUE.) 

 

9 Replies

    • boukasa's avatar
      boukasa
      Brass Contributor
      Juliano-Petrukio, the IF approach creates a dynamic array that does not require copy-down maintenance. I am looking for a solution that continues to work automatically when new projects and volunteers are added.
      • PeterBartholomew1's avatar
        PeterBartholomew1
        Silver Contributor

        boukasa 

        Array of arrays are a major headache!  The best I have come up with is to write a Lambda function that returns one volunteer from one team by index

        = LAMBDA(projectNum,idx,
              LET(
                  project,   INDEX(ProjectCodes, projectNum),
                  team,      FILTER(Projects[Volunteer], Projects[Project]=project),
                  volunteer, INDEX(team, idx),
                  IFERROR(volunteer, "")
              )
          )

        Turning the formula into a Named Lambda function, one can then use it within MAKEARRAY to give

        = MAKEARRAY(4,3,VolunteerĪ»)

        I am told it is also possible to do this with 'thunks' (arrays placed within a Lambda function that may be expanded using an empty parameter string) but I have yet to make that work.

Resources