简体   繁体   中英

Simple question about easier way to check inequalities

I have some data in column L (from L69 to L74). I want to make the following thing :

(1) If L69>L70>L71>L72>L73>L74 then I want to return 1, otherwise 0.

(2) If L69>L70>L71>L72>L73>L74 then I want to return 1, otherwise 0, but only one of inequalities may not be truth.

My work so far :

(1) Firsly i tried to do

(I used fact that a>b>c>d>e>f<=>a>b and a>c and a>d and a>e and a>f and b>c and b>d and b>e and b>f and c>d and c>e and c>f and d>e and d>f and e>f)

    =IF(L69>L70>L71>L72>L73>L74;1;0)  #But it doesn'worked becouse it has to many conditions. Therefore i program : 
    =IF(AND(L69>L70;L69>L71;L69>L72;L69>L73;L69>L74;L70>L71;L70>L72;L70>L73;L70>L74;L71>L72;L71>L73;L71>L74;L72>L73;L72>L74;L73>L74);1;0) 

#And it's working but can I do it by easier way ?

(2) I know how to do it by cases but it would be a very long code. Can you give me any clue how to do it by more simple way than considering all cases ?

You can use two equal size but offset ranges in the and:

=--AND(A1:A6<A2:A7)

May require the use of Ctrl - Shift - Enter instead of Enter when exiting edit mode. My version does not require the use of CSE.

在此处输入图片说明

在此处输入图片说明

I like Scott Craner's answer but I'd like to present an alternate method.

If you insert one column after L, you can make an equation that will sequence your whole L column. In cell M2, write =IF(L2<L3,1,0) then copy and paste to last row of data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM