CF in a cell with 6 conditions

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,213
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
I want to formulate 6 CFs in a cell B1 to generate either of the value 1,2,3,4,5,6.

6 CFs are to be formulated to generate either of:
CF1=1: A1 is less than B1; B1 is less than C1 and A1 is less than C1
CF2=2: A1 is less than B1; B1 is greater than or equal to C1 and A1 is less than C1
CF3=3: A1 is less than B1; B1 is greater than or equal to C1 and A1 is greater than or equal to C1
CF4=4: A1 is greater than or equal to B1; B1 is greater than or equal to C1 and A1 is greater than or equal to C1
CF5=5: A1 is greater than or equal to B1; B1 is less than C1 and A1 is greater than or equal to C1
CF6=6: A1 is greater than or equal to B1; B1 is greater than or equal to C1 and A1 is less than C1



What should the formula be in the CF? Thanx in adv.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Aside from the row with the question marks, does the result column look correct?

A​
B​
C​
D​
1​
A1
B1
C1
result
2​
0​
0​
0​
4​
3​
1​
0​
1​
5​
4​
0​
0​
1​
??​
5​
0​
1​
0​
3​
6​
0​
1​
1​
2​
7​
0​
1​
2​
1​

<tbody>
</tbody>


The formula in E2 and down is

=CHOOSE(4*(A2>=B2) + 2*(B2>=C2) + (A2>=C2) + 1, 1, "impossible", 2, 3, "??", 5, "impossible", 4)

What should be the result in row 4?

First of all, the formula is needed in B1 cell in the 'CF Rules Manager' to generate either of 1,2,3,4,5,6.
Your comment:"result in row 4": Answer: Here 'AMENDED' CF6 comes into play. Result=6
'AMENDED' CF6=6: A1 is greater than or equal to B1; B1 is LESS than C1 and A1 is less than C1
I'll post a sample data. Have a look & then confirm the formula
Sheet1

ABCD
13004005001
23006005002
33004002003
43002001004
53002002505
63003005006

<tbody>
</tbody>

Although the table shows result to be 'appearing' in column D but I need it to be generated in B1 cell in the 'CF Rules Manager'.
There are 3 cells only A1, B1 & C1.
A1 & C1=Values.
Output in B1 cell in the 'CF Rules Manager' to generate either of 1,2,3,4,5,6.
 
Last edited:
Upvote 0
I'll reconstruct the CFs in B1 and make it 7 as:

6 CFs are to be formulated to generate either of:
CF1=1: A1 is less than B1; B1 is less than C1 and A1 is less than C1
CF2=2: A1 is less than B1; B1 is greater than or equal to C1 and A1 is less than C1
CF3=3: A1 is less than B1; B1 is greater than or equal to C1 and A1 is greater than or equal to C1
CF4=4: A1 is greater than or equal to B1; B1 is greater than or equal to C1 and A1 is greater than or equal to C1
CF5=5: A1 is greater than or equal to B1; B1 is less than C1 and A1 is greater than C1
CF6=6: A1 is greater than or equal to B1; B1 is less than C1 and A1 is less than C1
CF7=7: A1 is greater than or equal to B1; B1 is less than C1 and A1 is equal to C1
 
Upvote 0
Finally: total 10 CFs in B1:

6 CFs are to be formulated to generate either of:
CF1=1: A1 is less than B1; B1 is less than C1 and A1 is less than C1
CF2=2: A1 is less than B1; B1 is greater than or equal to C1 and A1 is less than C1
CF3=3: A1 is less than B1; B1 is greater than or equal to C1 and A1 is greater than or equal to C1
CF4=4: A1 is greater than or equal to B1; B1 is greater than or equal to C1 and A1 is greater than or equal to C1
CF5=5: A1 is greater than or equal to B1; B1 is less than C1 and A1 is greater than C1
CF6=6: A1 is greater than or equal to B1; B1 is less than C1 and A1 is less than C1
CF7=7: A1 is greater than or equal to B1; B1 is less than C1 and A1 is equal to C1


ADD 3 more CFs (now totalling 10)
CF8=8: A1 is equal to B1; B1 is equal to C1 and A1 is equal to C1
CF9=9: A1 is greater than B1; B1 is greater than C1 and A1 is less than C1
CF10=10: A1 is equal to B1; B1 is greater than C1 and A1 is greater than C1
 
Upvote 0
Instead of me figuring that out, how about you complete this table:

L​
M​
N​
P​
2​
A1:B1
B1:C1
A1:C1
CF
3​
<​
<​
<​
??​
4​
<​
<​
=​
??​
5​
<​
<​
>​
??​
6​
<​
=​
<​
??​
7​
<​
=​
=​
??​
8​
<​
=​
>​
??​
9​
<​
>​
<​
??​
10​
<​
>​
=​
??​
11​
<​
>​
>​
??​
12​
=​
<​
<​
??​
13​
=​
<​
=​
??​
14​
=​
<​
>​
??​
15​
=​
=​
<​
??​
 
Upvote 0
Instead of me figuring that out, how about you complete this table:

L​
M​
N​
P​
2​
A1:B1
B1:C1
A1:C1
CF
3​
<​
<​
<​
??​
4​
<​
<​
=​
??​
5​
<​
<​
>​
??​
6​
<​
=​
<​
??​
7​
<​
=​
=​
??​
8​
<​
=​
>​
??​
9​
<​
>​
<​
??​
10​
<​
>​
=​
??​
11​
<​
>​
>​
??​
12​
=​
<​
<​
??​
13​
=​
<​
=​
??​
14​
=​
<​
>​
??​
15​
=​
=​
<​
??​

<tbody>
</tbody>
Answers:

Sheet1 (2)

P
1
2
31
411
512
613
714
815
916
1017
1118
1219
1320
1421
1522

<colgroup><col style="FONT-WEIGHT: bold; WIDTH: 30px"><col style="WIDTH: 48px"></colgroup><tbody>
</tbody>
 
Upvote 0
My apologies, I posted the wrong list. It should be

R​
S​
T​
U​
V​
2​
A1:B1
B1:C1
A1:C1
Case
CF
3​
<​
<​
<​
1​
??​
4​
<​
=​
<​
3​
??​
5​
<​
>​
<​
6​
??​
6​
<​
>​
=​
7​
??​
7​
<​
>​
>​
8​
??​
8​
=​
<​
<​
9​
??​
9​
=​
=​
=​
13​
??​
10​
=​
>​
>​
17​
??​
11​
>​
<​
<​
18​
??​
12​
>​
<​
=​
19​
??​
13​
>​
<​
>​
20​
??​
14​
>​
=​
>​
23​
??​
15​
>​
>​
>​
26​
??​

The formula in U3 and down is

=9*SIGN(O3-P3) + 3*SIGN(P3-Q3) + SIGN(O3-Q3) + 14

The formula you need will be like

=LOOKUP(9*SIGN(A1-B1) + 3*SIGN(B1-C1) + SIGN(A1-C1) + 14, {1,3,6,7,8,9,13,17,18,19,20,23,26}, {1,3,6,7,8,9,13,17,18,19,20,23,26})

Except replace the second array with the results you want.
 
Upvote 0
O,P,Q & A,B,C (from the above formula) doesn't match with the table's headers but probably it is like the table should be read as with column headers being A B C D E & to replace O,P,Q with A,B,C in your 1st formula. (Please correct me if I am wrong here).
The formula needs to be punched in F1 probably & copied down thr' F1:F13. (Please correct me if I am wrong here).

Some logic seems to be in your mind for adding another column V (column E in case of ABCDE). Can you share the logic?
 
Upvote 0
The columns weren't shown because they just contained the numbers used to calculate the valid subsets of comparisons:

O​
P​
Q​
R​
S​
T​
U​
V​
2​
A1:B1
B1:C1
A1:C1
A1:B1
B1:C1
A1:C1
Case
CF
3​
0​
1​
2​
<​
<​
<​
1​
??​
4​
0​
1​
1​
<​
=​
<​
3​
??​
5​
0​
2​
1​
<​
>​
<​
6​
??​
6​
0​
1​
0​
<​
>​
=​
7​
??​
7​
1​
2​
0​
<​
>​
>​
8​
??​
8​
0​
0​
1​
=​
<​
<​
9​
??​
9​
0​
0​
0​
=​
=​
=​
13​
??​
10​
1​
1​
0​
=​
>​
>​
17​
??​
11​
1​
0​
2​
>​
<​
<​
18​
??​
12​
1​
0​
1​
>​
<​
=​
19​
??​
13​
2​
0​
1​
>​
<​
>​
20​
??​
14​
1​
0​
0​
>​
=​
>​
23​
??​
15​
2​
1​
0​
>​
>​
>​
26​
??​

I changed the references to use the cells you asked for in the second formula I posted:

=LOOKUP(9*SIGN(A1-B1) + 3*SIGN(B1-C1) + SIGN(A1-C1) + 14, {1,3,6,7,8,9,13,17,18,19,20,23,26}, {1,3,6,7,8,9,13,17,18,19,20,23,26})

Some logic seems to be in your mind for adding another column V (column E in case of ABCDE).

Column V is there for you to specify what result you want for the CF formula for each of the 13 possible cases. Then you would use those to replace the second array in the LOOKUP formula.
 
Upvote 0
Is this easier to follow?

A​
B​
C​
D​
E​
1​
0​
1​
2​
1
D1: =LOOKUP(9*SIGN(A1-B1) + 3*SIGN(B1-C1) + SIGN(A1-C1) + 14, {1,3,6,7,8,9,13,17,18,19,20,23,26}, {1,3,6,7,8,9,13,17,18,19,20,23,26})
2​
0​
1​
1​
3
3​
0​
2​
1​
7
4​
0​
1​
0​
8
5​
1​
2​
0​
9
6​
0​
0​
1​
9
7​
0​
0​
0​
13
8​
1​
1​
0​
18
9​
1​
0​
2​
19
10​
1​
0​
1​
20
11​
2​
0​
1​
20
12​
1​
0​
0​
23
13​
2​
1​
0​
26
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,927
Members
449,094
Latest member
teemeren

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