Forum Discussion
kevinlobbbigpondcom
Feb 15, 2024Copper Contributor
Excel problem
I am trying to use an IF formula to tell me if a number is greater than and less than two numbers. For example: minimum number is 3, maximum number is 10. Question is, is 7 between these two numbers...
Patrick2788
Feb 16, 2024Silver Contributor
With the sample data you provided, you could keep it simple with MEDIAN:
=IF(B3=MEDIAN(B1:B3),"A","B")
- PeterBartholomew1Feb 16, 2024Silver Contributor
In part the difference between our formulas is that yours applies to the single input value specified by the OP whereas I went for an array of inputs. Comparing like with like we might have
= IF( MAP(input, LAMBDA(value, MEDIAN(value, bounds) = value)), "A", "B" ) = IF( BYROW(input<TOROW(bounds), XOR), "A", "B" )which are somewhat similar.
An interesting difference is that your MEDIAN formula assumes a closed range whereas I have one closed bound and one open.
- Patrick2788Feb 16, 2024Silver ContributorIndeed. I've been accused of offering 'complex solutions' to simple problems so I must not indulge at each opportunity!
- PeterBartholomew1Feb 16, 2024Silver ContributorBig grin! Surely not, how could anyone accuse us of that!