I hope, I can help me!
I have a data frame as this:
A B C D E F G
1 4 2 3 0 0 0 (Here the formula)
2 0 0 0 0 0 0 (Here the formula)
3 3 2 4 5 0 0 (Here the formula)
4 0 0 0 0 5 2 (Here the formula)
5 0 0 0 5 5 5 (Here the formula)
in column G, a counting formula must be according to the following criteria: With <>:distinct of
I have sum the count(if(A2<>0 and A3<>0) + (B2 and B3)....
for example: I tried to make this;
in G1
=SUM(COUNT(IF(AND(A1<>0;A2<>0);1;0);COUNT(IF(AND(B1<>0;B2<>0);1;0);COUNT(IF(AND(C1<>0;C2<>0);1;0).....COUNT(IF(AND(F1<>0;F2<>0);1;0);COUNT(IF(AND(A1<>0;A3<>0);1;0);COUNT(IF(AND(B1<>0;B3<>0);1;0);COUNT(IF(AND(C1<>0;C3<>0);1;0).....COUNT(IF(AND(F1<>0;F3<>0);1;0);............
COUNT(IF(AND(A1<>0;A5<>0);1;0);COUNT(IF(AND(B1<>0;B5<>0);1;0);COUNT(IF(AND(C1<>0;C5<>0);1;0).....COUNT(IF(AND(F1<>0;F5<>0);1;0))
for each G2, G3,...G5
that is to say, I want to count only the cells in which there are only non-zero values in the same column and add them, it would be something like this:
G1 is equal to:
= (0 + 3 + 0 + 0)
G2 is equal to:
= (0 + 0 + 0 + 0)
G3 is equal to:
= (3 + 0 + 0 + 1)
G4 is equal to:
= (0 + 0 + 0 + 0)
G4 is equal to:
= (0 + 0 + 1 + 2)
I hope you can help me
Put this in G1:
=SUMPRODUCT((A1:F1<>0)*($A$1:$F$5<>0)*(ROW($A$1:$F$5)<>ROW(A1:F1)))
And copy down.
Related
I have dataframe that has 50 columns each column have either 0 or 1. How do I return all rows that have an equal (tie) in the number of 0 and 1 (25 "0" and 25 "1").
An example on a 4 columns:
A B C D
1 1 0 0
1 1 1 0
1 0 1 0
0 0 0 0
based on the above example it should return the first and the third row.
A B C D
1 1 0 0
1 0 1 0
Because you have four columns, we assume you must have atleast two sets of 1 in a row. So, please try
df[df.mean(1).eq(0.5)]
I'm trying to populate cells based on values from two different cells.
Values in the cell needs to be (n-1) where n is the input and then repeated based on the amount of the other cell.
For example, I have input:
x y
2 5
Output should be:
x should have 0 and 1; each repeated five times
y should have 0, 1, 2, 3, 4; each repeated twice
x1 y1
0 0
0 1
0 2
0 3
0 4
1 0
1 1
1 2
1 3
1 4
I used:
=IF(ROW()<=C2+1,K2-1,"")
and
=IF(ROW()<=d2+1,K2-1,"")
but it is not repeating and I only see:
x y
0 0
1 1
__ 2
__ 3
__ 4
(C2 and D2 are where values for x and y are, K is the number of items.)
Are there any suggestions on how I can do this?
In Row2 and copied down to suit:
=IF(ROW()<=1+C$2*D$2,INT((ROW()-2)/D$2),"")
and
=IF(ROW()<=1+C$2*D$2,MOD(ROW()-2,D$2),"")
According to the image below, it says the output ports are from F0-F7H. My question is how are these ports addresses determine? For example, F0(active low) (Y0) is determine from the inputs A0-A7 inputs? If so, how are these input ports mathematically come to F0?
The 74ALS138 is a 1-8 demultiplexer, this means it takes a number between 0 and 7 and activates one of its eight output lines (active low).
The A, B and C input signals are the three bit encoding the input number (23 = 8) while G1, GA and GB are the enable signals.
To enable the chip G1 must be high and GA and GB must be low, any other combination will disable the chip (all output is high).
To have G1 high we must have the bit 4 of the address high, analogously bit 5, 6 and 7 must be high.
Finally, bit 3 must be low.
This gives an address of the form 1111 0xxx, ranging from 0f0h to 0f7h.
The lowest three bits select the output line.
Regarding the tie between A, B and C and the outputs, you can start with a truth table:
A B C Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
0 0 0 0 1 1 1 1 1 1 1
0 0 1 1 0 1 1 1 1 1 1
0 1 0 1 1 0 1 1 1 1 1
0 1 1 1 1 1 0 1 1 1 1
1 0 0 1 1 1 1 0 1 1 1
1 0 1 1 1 1 1 1 0 1 1
1 1 0 1 1 1 1 1 1 0 1
1 1 1 1 1 1 1 1 1 1 0
Each output Yi must be computed independently; since each of them is zero exactly once, there is no need to optimize it with a Karnaugh map and since there are a lot of ones, working with Maxterms is definitively better.
So for example for Y0 the formula is
Y0 = A + B + C
Due to the rules when dealing with maxterms (It's a product of sum, each factor being negated iif the input variable is 1).
The other relations are
Y1 = A + B + C'
Y2 = A + B' + C
Y3 = A + B' + C'
Y4 = A' + B + C
Y5 = A' + B + C'
Y6 = A' + B' + C
Y7 = A' + B' + C'
This doesn't take into account the enable inputs, internally we can have a single enable signal E by taking E = G1 * GA' * GB' then the truth table for Y0 becomes
E A B C Y0
0 0 0 0 1
0 0 0 1 1
0 0 1 0 1
0 0 1 1 1
0 1 0 0 1
0 1 0 1 1
0 1 1 0 1
0 1 1 1 1
1 0 0 0 0
1 0 0 1 1
1 0 1 0 1
1 0 1 1 1
1 1 0 0 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 1
This just translates to Y0 = E' + A + B + C.
If you consider that X + Y === (X' * Y')' by De Morgan's laws and call (X * Y)' NAND you see that Y0 = NAND(E, A', B', C') which is exactly the implementation in the 74ALS138 datasheet:
Datasheet courtesy of Matt Clark
The table in the data sheet seems quite clear: Y0 is active if A0, A1, A2, and A3 are low and A4, A5, A6, and A7 are high. Y1 is active under all the same conditions except A0 is high.
Thanks for the comments to help me connect the dots in figuring out how the address is map to the input address
Having this kind of data:
A B C D E
1 1 0 1 0 0
2 0 1 1 0 1
3 1 0 1 1 0
4 0 1 0 1 0
I would like to show true/false in column F if column A, C and E has the value of 1.
So not looking for a value in range - but different columns.
You can use the AND function, something like:
=IF(AND(A1=1,C1=1,E1=1),"TRUE","FALSE")
=IF(A2;IF(C2;IF(E2;TRUE;FALSE);FALSE);FALSE)
This will display TRUE if ALL three cells are 1, else FALSE.
i have some problem in how to compare boolean cells.
Let say like this
A B C D E F G H I
1 1 1 1 1 0
1 0 1 1 1 1
0 1 1 0 1 1
0 0 0 1 1 1
In cell G2 i need to calculate and compare every 3 celss.
if "sum" of A2:C2 = 3, then return 0, but if "sum" of A2:C2 <=2, then "sum" B2:D2, if "sum" of B2:D2 = 3 then return 1 else 0
In cell H2 i need to do the same.
if "sum" of B2:D2 = 3, then return 0, but if "sum" of B2:D2 <=2, then "sum" C2:E2, if "sum" of C2:E2 = 3 then return 1 else 0
and so on
i already try IF, AND, SUM but still not working.
Thanks for your help...