If AND? If OR?

cyd000

New Member
Joined
Sep 22, 2015
Messages
9
I have three columns of numbers


A1
B1
C1
1158.50
1562.50
1250.00

<tbody>
</tbody>


I need a formula that looks at all three numbers and returns one of them based on criteria.

If A1 is bigger than B1 or C1, then B1 should be returned. If C1 is bigger than A1, then C1 should be returned. If A1 is bigger than C1 but smaller than B1 then A1 should be returned.

Nothing I am familiar with IF(AND, IF(OR, SUMIFS will work.

Any ideas?
 
Unless C1 is bigger than A1, the conditions resolve to "return the middle value"
=IF(C1>A1, C1, SUM(A1:C1)-MIN(A1:C1)-MAX(A1:C1))
 
Last edited:
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi,

I'm going to give it another shot, I "think" I got it right this time...maybe...

=IF(C1>A1,C1,IF(A1< B1,A1,B1))
 
Last edited:
Upvote 0
Unless C1 is bigger than A1, the conditions resolve to "return the middle value"
=IF(C1>A1, C1, SUM(A1:C1)-MIN(A1:C1)-MAX(A1:C1))

If we always want the middle of three values,
=LARGE(A1:C1, 2)

Edit: Oops! forgot to finish
=IF(C1 > A1, C1, LARGE(A1:C1, 2))
 
Last edited:
Upvote 0
Unless C1 is bigger than A1, the conditions resolve to "return the middle value"

If we always want the middle of three values

Unfortunately, I don't believe it's always the middle value...

Using the formula in my post #12:


Excel 2010
ABCDF
11233
23212
34323
45454
54534
Sheet1
Cell Formulas
RangeFormula
F1=IF(C1>A1,C1,IF(A1))
 
Upvote 0
Thank you all SO much!

I used =IF(A1>B1,IF(A1< C1,C1,B1),A1) from jtakw and it works great.

To answer the question about there being = values. I reviewed a couple of months worth of numbers and couldn't find an instance, I think it would be highly unlikely but I wonder if I should take that into account?
 
Upvote 0
Thank you all SO much!

I used =IF(A1>B1,IF(A1< C1,C1,B1),A1) from jtakw and it works great.

To answer the question about there being = values. I reviewed a couple of months worth of numbers and couldn't find an instance, I think it would be highly unlikely but I wonder if I should take that into account?

Hi cyd000,

Thanks for the feedback, unfortunately, my formula (from post #6) as you stated in the above post, gives incorrect result when A1 is smaller than B1 and C1.
I've compiled a table showing all the suggested formulas so far, the highlighted cells are where I believe the formula fails your logic in OP, so it seems the only working formula is the one from my post #12 (Column J formula in this sample highlighted Green).


Excel 2010
ABCDEFGHIJK
11233313333
23212222222
34355353555
45455444545
54534545444
64455545555
74434444444
8
9Post #2Post #3Post #6Post #8Post #11Post #12 & 14Post #13
Sheet1
Cell Formulas
RangeFormula
E1=IF(A1>C1,IF(A1>B1,B1,A1),MAX(A1,C1))
F1=IF(OR(A1>B1,A1>C1),B1,IF(C1>A1,C1,IF(AND(A1>C1,A1),A1,"")))
G1=IF(A1>B1,IF(A1< C1,C1,B1),A1)
H1=IF(OR(A1>B1,A1>C1),B1,IF(C1>A1,C1,IF(OR(A1>C1,A1),A1,"")))
I1=IF(C1>A1, C1, SUM(A1:C1)-MIN(A1:C1)-MAX(A1:C1))
J1=IF(C1>A1,C1,IF(A1< B1,A1,B1))
K1=IF(C1 > A1, C1, LARGE(A1:C1, 2))


Please review and confirm.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,544
Messages
6,125,438
Members
449,225
Latest member
mparcado

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top