Count rows that have cell don't existing in a list in Excel - excel-2007

Please see my image
I am have two questions:
Do you know what is the proper function to count number of rows that have F column value don't exist in range J3:J15 (expect result is 3, as the image)
List/or show values in Column A, B of above rows (the rows that have F column value don't existing)

Way №1
In cell H2 use:
=IF(ISNUMBER(MATCH(F2,$J$3:$J$15,0));"exist in list","not exist in list")
and drag it down.
Then in C12 you can use:
=COUNTIF(H2:H8;"not exist in list")
Way №2
In C12 use:
=SUMPRODUCT(1*NOT(ISNUMBER(MATCH($F$2:$F$8,$J$3:$J$15,0))))
This is an array formula, so type the formula then press CTRL+SHIFT+ENTER. Curly brackets will automatically appear at the start and end of the formula.
Then for returning list of corresponding values in column A use, say, in F12:
=IFERROR(INDEX(A:A,SMALL(IF(NOT(ISNUMBER(MATCH($F$2:$F$8,$J$3:$J$15,0))),ROW($F$2:$F$8)),ROW()-ROW($F$12)+1)),"")
this is also array formula, so press CTRL+SHIFT+ENTER to evaluate it and then drag formula down.
and in G12 for returning corresponding values from column B:
=IFERROR(INDEX(B:B,SMALL(IF(NOT(ISNUMBER(MATCH($F$2:$F$8,$J$3:$J$15,0))),ROW($F$2:$F$8)),ROW()-ROW($F$12)+1)),"")
also with array entry(CTRL+SHIFT+ENTER).

Related

How to use INDEX and MATCH to based to cells?

I have two sheets of data in excel. I want to combine cells to bring the second cell value. Here is an example:
when I enter combining columns name and list must get value form V1 and V2.like this:
I don't have the time to type your data, so this is a rare case of a non-tested formula and may need some tweaking.
For the V1 result: (top screenshot starts in Sheet1 column A, bottom screenshot in Sheet2, column A). This formula goes into cell B2 in Sheet 2:
=Index( Sheet1!$E$2:$E$100, MATCH(Sheet2!a2,INDEX(Sheet1!$A$1:$A$100&" | "&Sheet1!$D$1:$D$100,0),0))
Adjust the first index range from column E to F for the V2 result in C2.
Copy down.
Don't use that approach with whole columns. It will be slow. Use ranges with defined rows.
Of course, if the codes in Sheet1 column A are unique, you don't need to combine them with the value in column D and can look up only the first three characters, like this for V1 (use 6 for V2)
=vlookup(Left(Sheet2!A2,3),Sheet1!$A:$F,5,0)

Return values under a column if the value in anther column does not equal to zero

So what I need to do is basically to return the values in column E to column I if the values under column G is non-zero. I was able to return all the non-zero values under column G to column K, but I not sure if I could retrieve the corresponding values under column E and F to I and J.
Is this something that could be done by a formula, or I have to use VBA?
Appreciate any insights! I've attached the sample here:
If you are not worried about duplicated items on column G, you should be able to use a combination of INDEX() and MATCH():
=INDEX(E$1:E$7,MATCH($K1,$G$1:$G$7,0))
If you have issues with duplicate values use the following array formula (Press Ctrl+Shift+Enter after editing the formula).
For Cell I1 use the following (drag it to cells J1 and K1):
=+INDEX(E$1:E$8,MATCH(TRUE,INDIRECT("g"&1+1):$G$8>0,0))
And for the rest, copy the following formula on cell I2 and drag it down and to the right:
=+INDEX(E$1:E$8,MATCH(TRUE,INDIRECT("g"&MATCH(I1,E$1:E$8)+1):$G$8>0,0)+MATCH(I1,E$1:E$8))

How do I insert a row in excel and include the inserted row in a formula?

Example:
I have a cell "A1" that sums up some values in a row "IF"-something: =SUM.IF($C$5:$C$10;"Blue";$D$5:$D$10)
meaning: If columns C5 to C10 contains the word "Blue" in any row for example. "C7" and "C9", then the sum of "D7" and "D9" will be shown in "A1".
My problem:
If I insert a new row "5", then I want the formula to contain this row as well:
=SUM.IF($C$5:$C$11;"Blue";$D$5:$D$11)
But what happens is that the formula is now:
=SUM.IF($C$6:$C$11;"Blue";$D$6:$D$11)
So the formula contains only the original 5 rows "5-10" and now named "6-11".
How do I make excel expand the formula to include the new row aswell so it sums up from "5-11" =SUM.IF($C$5:$C$11;"Blue";$D$5:$D$11)?
(I know I can make this work with a table, but this is a thought example and not my real situation. Actually I insert 5 rows at a time, and some cells are merged, so I can't convert the range of data into a table)
Any help is greatly appreciated.
This can't be done. Set the row range reference in the formula to one row above you actual list, then everything should work.
For example, leave row 5 empty. Hide the row if you like. In cell A1, use the formula =SUMIF($C$5:$C$10,"Blue",$D$5:$D$10) (starting at row 5). Start entering values in row 6.
Now you can right-click Row 6 and Insert a new row, and the formula will continue to work as required.

If value match on different sheet, then copy data from the sheet one to other sheets

I have Sheet1, Sheet2, Sheet3, Sheet4
I want the formula i.e. if I enter any value in Sheet2, Sheet3, Sheet4 in Column E, then it should match that value with Sheet1 Column A, In case of value match, the data value of sheet1 should be copied to all other sheets.
EG:- In sheet1 I have the below mentioned data.
(A Column / B Column / C Column)
(Product Value / Cost / Packing)
(200 / 100 / 50)
(150 / 70 / 20)
(300 / 120 / 50)
(500 / 300 / 100)
To illustrate, if in Sheet2, Column E if I put a value 150, then the formula should scan for that value in Sheet1, Column A , and find its match in 2nd row, then it should copy the data of column B (i.e 70) to Sheet2 column N and similarly copy the Sheet1 column C (i.e 20) to Sheet2 column O.
If I enter value to Sheet2, Sheet3, Sheet4, Sheet5 then formula should scan the value only from Sheet1 and copy the data,to its respective places as described in the preceding paragraph.
This is relatively simple and straight forward to do with vlookup.
I am making the assumption that the value to lookup is in Cell E2 (regardless of the sheet)
Use the following formulas for Column N2 on Sheet2,3,4,5, etc and then drag down to how many rows as needed:
=VLOOKUP(E2,Sheet1!$A$2:$C$5,2,FALSE)
Use the following formulas for Column O2 on Sheet2,3,4,5, etc and then drag down to how many rows as needed:
=VLOOKUP(E2,Sheet1!$A$2:$C$5,3,FALSE)
Adjust the "$A$2:$C$5" formula part to match the appropriate range in your Sheet1 table. Or replace the "5" with the number of rows with product data in Sheet1. You can also use "Sheet1!A:C" to just search all the rows.
This formula does not "copy" the data to the other sheets, it merely displays the value based on the lookup value in column E.
The first argument of VLOOKUP is the Lookup value (the "product value"). We want to reference the cell in column E for this. (I used Cell E2, as I assume you have a column header in E1).
The second argument of VLOOKUP is the Table array (Sheet1!$A$2:$C$5). This is where we want to look for our value from column E. Keep in mind, vlookup only searches thru the first column for the criteria value. The dollar signs ($) make sure that the lookup table reference stays static and does not change if you try to autofill the formula down all the rows in your column.
The third argument of VLOOKUP is the column index. When it finds a match in the first column, this integer will tell vlookup which column to return. 1 returns the 1st column, 2 returns the 2nd, and so on.
The "FALSE" parameter tells the formula to only find exact match. If this is set to "TRUE" and your list is not sorted in ascending order, you will run into trouble with vlookup trying to find the closest match rather than an exact match.

Searching and comparing various values using VBA

I have to create a macro which will:
Get the value from the cell A1 search this value in column C.
If the value in cell A1 exists in column C, the macro needs to be compare the value in cell B1 with values in column D.
If the value in cell A1 exists in column C AND the value in cell B1 exists in column D, then the text "Values found" should appear in cell E1.
The above needs to happen for all non empty rows in column A.
I was trying to use the following formula:
=IF(ISERROR(MATCH(A2,$C$2:$C$138,0)),"Load number not found","Load number found")
But it not working as I want. I have limited access to internet so I can't check all web sites. Would you please help me. Thanks a lot.
To check if A1 is in column C and if B1 is in column D (in the same row A1 was found in column C), then you need to do the following:
=IF(ISERROR(MATCH(A1,$C:$C,0)),"Load number not found",IF(B1=INDEX($D:$D,MATCH(A1,$C:$C,0),1),"Load number found","Load number not found"))
The first IF checks if A1 is in column C, the second IF checks if B1 is in column D (in the same row A1 was found in column C)
It will return "Load number found" only if both conditions are true. Otherwise it will return "Load number not found".
You can write a macro to do the same thing. But the easier way is to lock the cells in column E only and protect the sheet so that users will not accidentally change any of the formulas.
Update:
Since Column C can have duplicates, need to use the following array formula:
=IF(ISERROR(MATCH(1,(A1=$C:$C)*(B1=$D:$D),0)),"Load number not found","Load number found")
When you paste this formula to E1, make sure to press CTRL + Shift + Enter instead of just pressing the Enter key.
If I understand, a conventional solution with formulae is to concatenate your C and D column data and then search that. If you insert a new columnC with:
=D2&E2
copied down to suit you could apply (but say in ColumnF rather than ColumnE) your existing formula with only slight modification:
=IF(ISERROR(MATCH(A1&B1,$C$2:$C$138,0)),"Load number not found","Load number found")
subject to quite what is in which row.