Count if two criteria match - EXCEL formula - excel

I have this table and I would like to create a formula which would count values based on true conditions from column A and column C.
Example:
If in column A value is M (male), and in column C is YES, then it would count.
could anyone help me with this formula?

Add the sheet name infront of the cell, e.g.:
=COUNTIFS(stock!A:A,"M",stock!C:C,"Yes")
Assumes the sheet name is "stock"

If youR data was in A1:C100 then:
Excel - all versions
=SUMPRODUCT(--(A1:A100="M"),--(C1:C100="Yes"))
Excel - 2007 onwards
=COUNTIFS(A1:A100,"M",C1:C100,"Yes")

Related

How to return the entire row based on two cells from two different Excel sheets matching?

I have a large Excel data file, with data from two different sheets. I want to be able to match the partner_identifier values from SO Sheet 2 to the values in BB Sheet 1. For the rows in BB Sheet 1 that do match, I want to bring the entire row into a new sheet.
I need help coming up with a formula for this. I've tried VLOOKUP and IF variations, but I think I need a more complex formula. I can't do an =IF('SO Sheet 2'!D3='BB Sheet 1'!D3) because the matching values could be in different rows.
Right now, I have (and I know this is off because it returned "No" for every row, even the ones with a matching value) :
=IF(D3='SO Sheet 2'!D3:D16,'BB Sheet 1'!D3,"No")
Any insight would be greatly appreciated!
If you are using latest version of excel (Excel for Microsoft 365) - you can use XLOOKUP or FILTER formula.
Example:
= FILTER('SO Sheet 2'!A3:D16, 'SO Sheet 2'!D3:D16=D3)
Check here for details about these formulas: XLOOKUP, FILTER
You can achieve the result in 2 steps. in Sheet "BB sheet 1", you need to add a column E with XLOOKUP formula to find the matching identifier in "SO sheet 2"
=XLOOKUP(D2,'SO Sheet 2'!$A$2:$A$14,'SO Sheet 2'!$A$2:$A$14,"No")
The above will list all the matching identifier and put "No" wherever if couldn't match the identifier.
Then all you got to do is , in a new sheet, enter the formula in cell A1
=FILTER('BB sheet 1'!A:D,'BB sheet 1'!E:E<>"No")

How to lookup a value from another column and display Row number?

I'm setting up an excel file for the operators. They will scan the Barcode from the product and it will populate in one of the column of the excel sheet.
I have tried using LOOKUP formula in excel but it doesn't seem to be working right.
COL A : Data from Database
COL B : Data from Scanner
COL C: Row number
Find the value of Column B in Col A and populate the Row no. in Column C.
=LOOKUP(B5,A:A,ROW(A:A))
I have used this formula in every cell of the column C.
The row number don't populate accurately.
=MATCH(B5,A:A,0) should give you the rownumber. And if you wish to obtain the cell's address: =ADDRESS(MATCH(B5,A:A,0),1,4,1)
If you are using combined cells then you definiately want to use absolute ranges like =MATCH(B5,$A$5:$A$10,0)
Search B column in A column and get row back. You could use:
Note:
Do not forget to use IFNA in case of B does not included in A.
In my opinion there is no need to target whole range.
=IFNA(MATCH(B1,$A$1:$A$6,0)+ROW($A$1:$A$6)-1,"")
Results:

Need help in excel to perform 4 cell lookup and copy in VBA

I have found VLOOKUP and it does not seem to match all of the criteria I need to perform.
The following is what has stopped me at this time. I would appreciate any assistance.
in excel, I need to match a value from a specific cell in spreadsheet A, column B, with a range of values in spreadsheet B, column C. Then in the row that the value in spreadsheet B is found, I need to obtain the value for the cell in column P and copy it into spreadsheet A column N.
Thank you,
While VLOOKUP has its uses I would always recommend using the INDEX function instead as you are not limited by using the leftmost column.
I think the type of formula you are looking for is (to be put in column N of spreadsheet A):
=INDEX('[Spreadsheet B]Sheet1'!P:P,MATCH(B1,'[Spreadsheet B]Sheet1'!C:C,0))
This would match the specific cell of B1 in Spreadsheet A with a value in column C in Spreadsheet B and then give provide the value in column P of the corresponding row. Obviously you should change out 'Spreadsheet B' with the name of your workbook and 'Sheet1' for the name of the worksheet in Spreadsheet B.

Comparing two columns in excel, returning data into another cell

I need help creating a formula in Excel 2010.
I have two worksheets - one that is a detail tab that is populated quarterly (Worksheet1), and the other one is a summary tab (Worksheet2).
In Column A of both worksheets I have a list of names. The formula needs to compare the names and if there is a match, Column E of Worksheet 2 needs to be populated with the data in Column C of Worksheet 1.
Please help - I have been banging my head on my desk all morning trying to figure this out.
Thanks.
In column E of sheet 2, use a conditional expression. For example, for row 1:
=IF(A1 = Sheet1!A1, Sheet1!C1, "" )
Copy this formula to every row of column E.

Excel Compare Cells Between Workbooks

I would like to create a macro that compares cells within Column E and if they are found to be matching then it would check/compare the date fields in Column H and the oldest date the macro would mark "yes" in Column R.
I'm newer to excel and not sure how to do this.
Assuming that you are creating a formula on Book1 to compare to Book2, then put this formula in Book1, Column R
=IF(E1=[Book2]Sheet1!E1,IF(H1=[Book2]Sheet1!H1,"yes",""),"")
Obviously you would need to change the Book Names and Sheet Names.
What did you mean by "Oldest Date"?

Resources