Extract Value from Column A and then get the count for certain values from Column B for the value in Column A - excel

The table structure that I have right now is as below:
Column A Column B
Apple 1
Apple 2
Apple 1
Orange 1
Orange 2
I am trying to write a formula where, for all the cells with the value of Apple in column A, I get the total count for values in column B equal to 1.
Please help.

As far as I can tell, you are just after the formula
=COUNTIFS(A:A,"Apple",B:B,1)

Related

Ignore text values in subtotal function

Excel-Sheet:
A B C D E
1 1.200
2 Product A 500
3 Product B 400
4 Product C OK
5 Product D #NA
6 Product E 300
7
8
In the above table I have list of products in Column A and some data about the products in Column B.
In Cell B1 I want to calculated the subtotal of Column B using =SUBTOTAL(9,B2:B6).
However, now I have the issue that Column B not only consists of numbers.
It can also have the data type text (OK, NA). Therefore, the result in Cell B1 currently is #NA.
Is there any kind of formula that I could use so only the number data is considered and the result is 1.200 as in the table above?
Please note:
This function =AGGREGATE(9,6,B2:B6) won't help me because I want to filter the list later on so I need to go with the SUBTOTAL.
Use 7 as the second criterion in AGGREGATE instead of 6 as it will also exclude hidden rows:
=AGGREGATE(9,7,B2:B6)
You can solve this, combining the Excel worksheet functions =Value() and =IfERROR():
The function =Value() gives the value of a number, and in case of text it gives an error.
=IfError() can be used to give 0 in that case.
So, imagine you have following situation:
Column A Column B Column C
1 =Value(A1) =IfError(B1;0)
3.5 =Value(A2) =IfError(B2;0)
AB =Value(A3) =IfError(B3;0)
abc10 =Value(A4) =IfError(B4;0)
This gives following results:
Column A Column B Column C
1 1 1
3.5 3.5 3.5
AB #Value 0
abc10 #Value 0
You can simply take the sum of column C.
So this is based on the summary in B1.
=SUM(IF(ISERROR(B2:B6),"",B2:B6))
You need to push Ctrl+Shft+Enter for this to work.
Hope it helps.

How to Count the number of times a cell in one column matches a cell in another column?

I have two columns. Column A is a list of text values. Column B will be individual text values that may or may not match Column A. Across say 20 rows, I want to use something like COUNTIF at the bottom of Column B to count how many answers in Column B match the correct answer in Column A.
For example, if Column A reads:
1. Apple
2. Orange
3. Banana
4. Kumquat
5. Pineapple
Column B reads:
1. Apple
2. Guava
3. Pistachio
4. Kumquat
5. Pineapple
Essentially, rows 1, 4 & 5 all match, thus the sum at the bottom of column B would be 3.
Is there a way to do this with a formula?
You can use something like this:
{=SUM(IF(A1:A5=B1:B5,1,0))}
To use this formula, type in any cell "=SUM(IF(A1:A5=B1:B5;1;0))" and press CTRL+SHIFT+INTRO

Rank like Subtotals

It's possible use Rank like Subtotals, that only use de showing data?.
If I filter data by a column, I want than Rank function only use these datas
Example
A B C The column C its Rank of column B
a 5 3
b 9 1
a 2 4
c 7 2
Now if I apply a filter in column A for value 'a'
A B C I want the rank recalculate with this new data
a 5 1 --> column C change from value 3 to value 1
a 2 2 --> column C change from value 4 to value 2
Thanks
You cannot do it by using RANK() formula, but you can create customizable rank formula. For this, You should add column at the and of table to indicate the row visibility, and put this formula into this column:
=(AGGREGATE(3;5;B2)>0)+0
Then put this formula into column C:
=SUMPRODUCT(($B$2:$B$9<B2)*($E$2:$E$9=1))+1
To check real example, download my sample file

A function that will lookup a reference

Before I get started thanks for taking your time and helping.
This is what my worksheet looks like:
Row # B C D E F
2 1 Product 1 B2 B3 B4
3 2
4 6
5 1 Product 2 B5 B6
6 5
7 4 Product 3 B7
I was trying to follow this formula: (The best answer one or green check mark) return values from multiple matching rows
I got all the way to the =IFERROR(INDIRECT(lookups!H5),"") but can not get this to work.
What I am tying to do is order the numbers in Column B to go to the right of the product. Which I was able to get the column it is in (B) and the row number it is in (B2). I would like to change the value (B2) to the number that is there.
I would like it to look like this:
Row # C D E F
2 Product 1 1 2 6
3
4
5 Product 2 1 5
6
7 Product 3 4
If someone could help explain this to me or find a better way that would be great.
Not sure what is to happen to columnB but if you replace B with "="B throughout columns D:F then select each of these in turn and apply Text to Columns with Tab as the delimiter the 'cell references' convert to formulae referring to the values in B. If you want to delete columnB copy D:F and Paste Special, Values over the top.

Excel vlookup help

Using vlookup, when a match occurs, I want to display the value of column C from sheet 2 from the same row where the match occurred. The formula I came up with takes the value from column C sheet 2 but it takes it from the row where the formula is pasted on sheet 3 instead of where the match occurred.
Here's my formula that doesn't work:
=IF(VLOOKUP(Sheet1!A:A,Sheet2!A:A,1,FALSE),Sheet2!C:C,"NODATA")
How can I take the value from the row where the match occurred?
To be clear, I am not entirely certain I understand what you are trying to achieve. Maybe the following helps...
Suppose I have 3 sheets in a workbook as follows:
Sheet1 Sheet2 Sheet3
A A B C A B
1 10 2 h Apple 10 Apple
2 20 g 4 Banana 25 n/a
3 30 l ! Pear 40 Grape
4 40 g * Grape 30 Pear
In column B of Sheet 3 I have the following formula:
=INDEX(Sheet2!$C$1:$C$4,MATCH(VLOOKUP(A1,Sheet1!$A$1:$A$4,1,FALSE),Sheet1!$A$1:$A$4,1))
To explain:
The VLOOKUP looks up the value from Sheet 3, Col A in Sheet1
The MATCH returns the row in Sheet1 of the VLOOKUP result
The INDEX then uses the row number to pick the right value from the value in Sheet2
Again, not sure if this is what you wanted exactly. It may help you get you started...
You need to manually get the index you're looking for, then get the value at that index:
=INDEX(Sheet2!C:C, MATCH(Sheet1!A:A,Sheet2!A:A,FALSE))

Resources