excel - COUNTIF wrapped in SUM (with curly brackets used but NOT an array formula) - this works, but why? -


(using 2007 - haven't tried in 2003).

let's have column this:

    1 blah 2 bleh 

... , want countif returns whether blah or bleh in cell.

so, if put =countif(a1,{"blah","bleh"}) in b1 return 1. if put =countif(a2,{"blah","bleh"}) in b2 return 0.

however --

if put =sum(countif(a1,{"blah","bleh"})) in b1 return 1, and; if put =sum(countif(a2,{"blah","bleh"})) in b2 magically return 1!

i've watched step-by-step using evaluate formula, , when use sum wrapper shows {"blah","bleh"} work array. key? because sum recognises arrays whereas countif doesn't?

i'm guessing that's case -- have documentation surrounding use of curly brackets , arrays in general (outside of actual array formulas) pretty scant.

can shed light on functions arrays can used with?

thanks in advance.

countif(a2,{"blah","bleh"}) returns array containing result each value. if enter array formula in b2:c2: =sum(countif(a2,{"blah","bleh"})) 0 , 1.

when apply sum function resulting array, sum (kind of expected!), 1.

note can use =countif(a2, "blah") + countif("bleh") desired result , if have many values, can use vlookup, like: if(iserror(vlookup(a2,rangewithallowedvalues,1,false)),0,1)


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -