Excel column sum where the condition is in a adjacent column - excel-formula

I have an Excel table with the name t that has columns A and B. column A has the values "YES" and "NO" and column B has the category names (lets say I have category c1 c2 c3). How can I count the amount of values YES in each category.
A B
YES c1
YES c2
YES c1
NO c3
NO c3
NO c2
YES c1
YES c1
In this example for category c1 the value is 3, for c2 it is 1 and for c3 it is 0.

=COUNTIFS(B1:B8,"c1",A1:A8,"yes")
Change c1 to whichever category you want.

I think you can use the pivot table.

Related

return a list of all elements present in one column that is not present in the other

I'm trying to create column where there are hundreds of items in a and b column, and I want to remove common items in b column and list them in different column in excel or google sheet.
a
b
items present in b column only
a1
a1
a5
a2
a2
a6
a3
a5
a4
a6
Excel:
Formula in C2:
=FILTER(B2:B5,COUNTIF(B2:B5,A2:A5)=0)
Google-Sheets:
Almost the same, but less explicit: =FILTER(B2:B,COUNTIF(B2:B,A2:A)=0)

Conditional transpose of rows to columns

I have the following table with around 500 rows that I need to transpose into columns:
A B
A1 B1
A2 B2
A3 B3
The result I'm trying to get is
A B C D E F
A1 B1 A2 B2 A3 B3
Because the results are to be the interleaving of two columns I think not a duplicate of the OP indicated (at one time). Assuming A1 is in cell A2 (i.e. A and B are column labels) I suggest in C2 and copied across to suit:
=IF(ISODD(COLUMN()),OFFSET($A1,COLUMN()/2,0),OFFSET($A1,(COLUMN()/2)-1,1))

Excel VBA to transpose multiple columns to single column multiple rows

I'm a beginner in VBA. Even after trying to find a solution and searching through all the forums, i was not able to find the correct way of dealing with this. Here's my problem:
Data ( in sheet1 )
a a1 a2 a3 a4
b b1 null b3 b4 b5
c c1 c2 c3
....
Required output ( in sheet2 )
a a1
a a2
a a3
a a4
b b1
b null
b b3
b b4
b b5
c c1
c c2
c c3
....
Thanks in advance.
Add column labels (may be deleted later) apply the process described here and filter ColumnC to delete rows blank in that column.

Compare a single row with a column and extract the value from another column on the same row in Excel

So I'm looking for a formula or anything that does something like this:
I have 4 Columns. A B C D.
I have a column (A) with multiple values that can have duplicates.
A1: A
A2: A
A3: B
A4: C
A5: C
I want to compare each row with a Column (B) that has one of each value. So B1 = A, B2 = B etc.
However the value I want to extract to column "D" is in Column "C". So if A1 equals anything in the Column B, I want to extract the value in Column C on the same row, to Column D.
So in D1 I want the value from C1. In D2 I want the value from C1 as well. But in D3 I want the value from C2.
This seems to work:
=VLOOKUP(A1:A5,B1:C5,2,0)
Entered as Array Formula in D1:D5 using Ctrl+Shift+Enter.
Result:

Get all combinations of the first column's value and other column's value

I have an irregular table in Excel:
A A1 A2 A3
B B1
C C1 C2 C3 C4
...
How can I get the following its representation?
A A1
A A2
A A3
B B1
C C1
C C2
C C3
C C4
...
This answer in SuperUser to Transform horizontal table layout to vertical table using VBA appears to give exactly what you are looking for.
The code is self explanatory by virtue of working step by step.
Hope it helps.

Resources