# Compare multiple columns

#### 300m

##### New Member
I would like to compare multiple columns and if all the results below are true, display the output "1" and if one of them is not true display the output "0".

O7>P7
Q7>R7
S7>T7
AA7> AB7
AG7>AH7

I tried with this formula, but it does not work:
=IF(O7>P7,1,IF(Q7>R7,1,IF(S7>T7,1,IF(AA7>AB7,1,IF(AG7>AH7,1,0)))))

Any help much appreciated.

### Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Like this?
=IF(AND(O7>P7,Q7>R7,S7>T7,AA7>AB7,AG7>AH7),1,0)

Yes, it works really well. Thank you very much!
Why does my formula not work?

If you have Excel 2002 or higher version, have you ever tried stepping through the pieces of your formula using Formula Auditing>Evaluate Formula? That should help you understand the error of your ways. When you're on the cell with formula Excel 2007 use Alt+M+V, in Excel 2002-2003 Tools>Formula Auditing>Evaluate Formula.

Here's what your formula is doing:
O7>P7 then "1" regardless of what is in any of the remaining groups of cells
O7 is NOT > P7 but Q7>R7 then "1" regardless of what is in any of the remaining groups of cells
O7 is NOT > P7 and Q7 is NOT > R7 but S7>T7 then "1" regardless of what is in any of the remaining groups of cells
ect.

I am on excel for mac 2011, not sure but don't think there is a Formula Auditing>Evaluate Formula. Anyway, thanks a lot for your clear explanation, I appreciate your effort.
Have a nice day!

Replies
7
Views
166
Replies
4
Views
246
Replies
4
Views
254
Replies
2
Views
229
Replies
7
Views
915

1,203,125
Messages
6,053,657
Members
444,676
Latest member
locapoca

### 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.

### Which adblocker are you using?

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

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