Excel - countif() - excel

i am having troubles with the excel function Countif.
I got 2 columns A and B and they should contain (almost) the same entries - which is what i am testing for and i need to know which entries are different. Order does not matter.
columns are actually tickers and look like this
http://pastebin.com/zHdJ5ndp
ok, so i use countif to identify the entries of column B which are not in column A.
Countif(A:A;B1)
Countif(A:A;B2)
...
The result is a column full of zeros, which is just not correct.
other simple tests like
a a 1
b b 1
c c 1
d d 1
e e 1
f f 1
g g 2
g h 0
work just fine!
What am I doing wrong right here?
Thanks in advance!

Are you sure the data in column A and B is the same (no extra space etc)?

Related

Using excel to count with conditions

I have an excel sheet that looks like this (with many more columns and rows of course):
condition a
condition b
condition c
condition d
result (a,b)
result (c,d)
yes
no
yes
no
0
1
no
no
no
yes
0
1
yes
yes
no
no
1
0
...
Now, I only want to separately count the occurrences of either a or b or both are occurring per row, but want to exclude all instances where either a or b (or both) are occurring together with c or d, since I want to count the occurrences where either c or d or both are apperearing separetely. I have toyed around with the idea of using the countifs, but my problem is that I want to count every row separately, so if a and b occur together I only want to count them once, so if I applied countifs to all the colums together, it would count all instances of yes in the a and b column.
For example here in the first row, I would get a 1 for c,d and a 0 for a,b since while there is a yes for a in the first row, there is also one for c.
In the second row, we only have yes for d so it's easy that it's easyily 1 for c,d and 0 for a,b.
And finally in the third row we only have a,b both yes, so it's 1 for a,b since I want to know the occurence per row, and since there is no for both c and d, and so it's 0 for c,d since both are no.
Does anyone know how to solve this in excel? Thank you all for your help
Use AND and OR (COLUMN E):
=--AND(AND(C2<>"yes",D2<>"yes"),OR(A2="yes",B2="yes"))
And (COLUMN F)
=--OR(D2="yes",C2="yes")
If you want to count without the helper columns:
A,B:
=SUMPRODUCT(((C2:C4<>"yes")*(D2:D4<>"yes"))*((A2:A4="yes")+(B2:B4="yes")>0))
C,D:
=SUMPRODUCT(--((C2:C4="yes")+(D2:D4="Yes")>0))

VLOOKUP issue in Excel

I have the following basic VLOOKUP setup, having not used Excel in anger for a while. I am looking up the values a, b and C in a table containing two columns.
<value returned> <expected>
a 1 b =VLOOKUP(A1,C$1:D$1,1,FALSE) #N/A #N/A
b 2 c =VLOOKUP(A2,C$2:D$2,1,FALSE) #N/A 2
c 3 d =VLOOKUP(A3,C$3:D$3,1,FALSE) #N/A 3
I am getting #N/A returned for all rows (as shown to the right), but I would expect the values to the right again to be returned. Can someone please explain what I have done wrong?
Thanks
If you still stick to dataset :
a 1 b
b 2 c
c 3 d
then : =INDEX($C$2:$C$4,MATCH(A1,$D$1:$D$3,0))
So if you re-arrange the data as :
a 2 b
b 3 c
c 4 d
then use : =INDEX($C$1:$C$3,MATCH(A1,$D$1:$D$3,0))
hope that helps. (:
When using VLOOKUP, the column containing the key to be matched has to be the first column on the left of the range. So change your data layout to this:
A B C D
a b 1
b c 2
c d 3
and use the following formula:
=VLOOKUP(A1, C$1:D$3, 2, FALSE)
and then it should work. As #Scott mentioned in his comment, if you want to keep your data layout the same, you could look into using INDEX.

SUMIFs in Google sheets with 2 filters on same criteria range

I have looked at various answers but all use filters on different columns. I need an OR type filter like this:
=SUMIFs(B2:B22,C2:C22,"Incurred",C2:C22,"Expected")
Where C2:C22 specifies if the cell in B is an incurred or expected or deferred expense.
How do I do this? Note the filters are on the same set of cells in column C.
This is the data in A6:C6:
1 A C
2 B D
3 A D
4 B C
5 A D
6 B D
To sum the values if column B is A or column C is D you can use:
=SUM(ARRAYFORMULA((IF(((B1:B6="A")+(C1:C6="D"))>0,A1:A6))))
This uses the fact that True equals 1 and False equals 0 once you want to use them in equation.
You may try this...
=SUMPRODUCT(((C2:C22="Incurred")+(C2:C22="Expected")+(C2:C22="Deferred"))*B2:B22)

How to sort 3 columns of data in excel

I'm using Microsoft Excel 2011 on a Mac, and I need help sorting 2200 rows of data.
Basically, what I want to do is to sort the Type column, while keeping its corresponding data beside it after the type is shifted.
I would like all the type A's, B's, and C's to be in order, and have their adjacent data from experiment 1 and 2 follow to the new position once sorted.
Each data group is separated by a few empty rows.
Here's a small example of what my data looks like:
Type EXPERIMENT 1 EXPERIMENT 2
A A F
F R
S S
E G
B Y A
A A
S H
F
A A E
D F
F S
E
Y
A F H
R G
E A
D F
Y W
S E
S
C F S
D D
S U
F J
Y
T
And this is what I want:
Type EXPERIMENT 1 EXPERIMENT 2
A A F
F R
S S
E G
A A E
D F
F S
E
Y
A F H
R G
E A
D F
Y W
S E
S
B Y A
A A
S H
F
C F S
D D
S U
F J
Y
T
In an unused column to the right (aka Helper column) put this formula into the second row.
=VLOOKUP("zzz",A$1:A2,1)&TEXT(COUNTIF(A$1:A2,VLOOKUP("zzz",A$1:A2,1)),"0000")
... and fill down as necessary. Select all of the columns and sort with the Helper column as the primary sort key. The results from your sample should mirror the following.
                 
Additional formulas can be provided if you need sorting key criteria on the Experiment x columns. Show what you've tried together with some example of the results expected and additional assistance will no doubt be offered.
It seems to me it would be easy to sort if you would concatenate each data set into a row. Type goes in column A; Exp 1 into one cell in column B; Exp 2 into one cell in column C. Then the sort is simple. Otherwise you'll require a complicated macro. You can always parse it out later if required.
To concatenate you'll need to:
Save as new workbook first to avoid changing your original data
Insert a row between the headers and the first data
Put the formulas indicated into row 2 and copy down
Copy and PasteSpecial as values
Sort by column D
Delete all rows that are false
Now your sorting will be easy.
Edit: fixed my formulas to line up with true column.

Compare columns in two sheets

I have two sheets in Excel that I am trying to compare. This is a bit convoluted so I hope my explanation is clear.
Sheet 1 is named 'mapping and Sheet 2 is named SOA
I would like to compare column D in 'mapping' to column A in 'SOA'
Where the value in column D of mapping is equal to the result in column A of 'SOA' I would like to enter the corresponding text info from column B of SOA into column E (which is blank) in 'mapping'
Column A in SOA is in ascending order while column D is not, and cannot be.
A sample for the data is:
Sheet 1 (Mapping)
A B C D E
A1.3
A1.1
A1.2
Sheet 2 (SOA)
A B C D E
A1.1 YES
A1.2 MAYBE
A1.3 NO
A1.4 IDK
The result I am looking for would give me:
Sheet 1 (Mapping)
A B C D E
A1.3 NO
A1.1 YES
A1.2 MAYBE
I have tried the following formulas but have not gotten any luck
=IF(COUNTIFS(('mapping'!D3:D466),=SOA!A4:A136",SOA!B4,""))
=IF('mapping'!$D3:$D466=SOA!$A4:$A136,SOA!$B4:$B136,"")
Thanks everyone, I got it working with a combo of all of this. Some of the issue was the nature of the data I receive

Resources