donjon
donjon

Reputation: 21

Excel - check if a value is within a number of ranges

I'm a noob. I would like to make Excel find out whether a value is within any of a set of specified ranges. See enclosed picture for my best effort this far. Doesn't work, unfortunately. Snapshot

Upvotes: 2

Views: 9609

Answers (2)

BigBen
BigBen

Reputation: 49998

Use COUNTIFS:

=IF(COUNTIFS(D:D;"<="&A2;E:E;">="&A2);"Yes";"No")

enter image description here

If your version of Excel supports Dynamic Arrays:

=IF(COUNTIFS(D:D,"<="&A2:A9,E:E,">="&A2:A9),"Yes","No")

Upvotes: 1

Harun24hr
Harun24hr

Reputation: 36780

If anyone interested to make it dynamic (spill array approach) then could go with BYROW().

=BYROW(A2:A8,LAMBDA(x,IF(MAX(($D$2:$D$8<=x)*($E$2:$E$8>=x))=1,"Yes","No")))

enter image description here

Upvotes: 0

Related Questions