Forum Discussion

Tanguy1684684214's avatar
Tanguy1684684214
Copper Contributor
Sep 16, 2026

FILTER formula

Hi,

I don't know how to add a filter so the answer of the formula is no longer {0;0;0,5} but only {0,5}

=FILTER(FILTER(A1:F6;(B1:B6="Z"));A1:F1="B")

I will highly appreciate if someone got the answer. many thanks.

 

2 Replies

  • djclements's avatar
    djclements
    Silver Contributor

    If you changed the order of the filtering so as to isolate the targeted column of data first, the second FILTER could then apply AND criteria by multiplying the single column of values by the second conditional argument (because zeros are interpreted as FALSE and all other numbers are interpreted as TRUE). For example, using LET and targeting the range of values only:

    =LET(col; FILTER(C2:F6;C1:F1="B"); FILTER(col;col*(B2:B6="Z")))

     

    If you still wanted to start by referencing the entire table (including headers and row labels), use (col<>0) in the second include argument to prevent the text values in the header row from causing a #VALUE! error:

    =LET(col; FILTER(A1:F6;A1:F1="B"); FILTER(col;(col<>0)*(B1:B6="Z")))

     

    Alternatively, REDUCE may be used to filter the data in 3 steps:

    =REDUCE(A1:F6;SEQUENCE(3);LAMBDA(a;v;FILTER(a;CHOOSE(v;B1:B6="Z";A1:F1="B";a))))

     

    I hope that helps point you in the right direction... ;)

  • mathetes's avatar
    mathetes
    Gold Contributor

    You're going to need to describe in English words, not in your attempt at Excelese, what it is you're trying to do.  

    That result of 0 and 0.5 is entirely logical if you're just saying show me the values in column D (AKA "B", by the way--there are ambiguities throughout your spreadsheet) where you see "Z" in B1:B6 (there you do use the correct column labels.

    In fact, if you get rid of your "A" "B" "C" "D" in row 1, replacing those with either nothing (they're not really needed, and are confusing maybe even to you; certainly to an outside observer) or with some other heading that represents what they are, Mon, Tue, Wed, Thu perhaps.... maybe the solution would be apparent to you.

    The only other thing I'd suggest, and again it depends on what you're actually trying to do, is this: to give FILTER multiple criteria for the screen, you use parentheses separated by * to indicate (criterion 1)*(criterion 2)

    Here's a good reference describing how to use FILTER.