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.
Related
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)
I have four columns A, B, C, D. The values of the cells start from A1,B1,C1,D1 and user may go up till A100,B100,C100,D100 (on click of a add button, after inserting values in each rows, one at a time)
When user will enter any value in A1 or B1 or C1, it should sum up and the value need to reflect in D1. There may be scenario like user may enter only values in one of the cell and leave other as it is. like A1 as blank, B1 as blank and C1 as 100. So in D1 it should reflect 100.
Just to mention, this is a protected sheet with a lot of different features, like cell level validation, sheet level validation, and the entire sheet will be locked other then one row where user will be able to enter the details and then he will click on ADD button, on click of this button, first all the fields will get validated and if successful then only a new row will be added.
Please help..
This doesn't require any VBA code. Just enter following formula in D1 cell: =A1+B1+C1 and drag it all the way down until 100th row. This way, blank cells are treated as 0.
So, if cells in A,B,C columns are blank, correspnding value in D column will be 0.
Also, value in D column would be raclculated on every change in column A,B,C in corresponding row.
I have value in A1 and another value in B1. I want to use a vlookup which checks if there is any value equal to A1 in Column A. And if These values match then B1 gets the value of the matching row of A.
As an example if A1 has a value Student and A6 has value Student. Then B1 should get the value of B6.
=VLOOKUP(
I know we use sth like this but i dont know how to fill the condition. Does anyone have any Suggestion?
=ADDRESS(MATCH(A1,C:C,0),3) where 3 is column C, you could use column(C1) here
What you are asking for cannot be done with a VLOOKUP. This is because if you are looking up a string in column A and using a reference from column A you will always return that string in column B, even if there is only one instance of that string. Unless that string did not exist in column A in the first place and then you would get an "#N/A".
The best way to solve your problem is to run a COUNTIF formula in column B, this will tell you how many instances of that string are found in column A.
Enter this into column B, and extend down:
=COUNTIF(A:A,A2)
Add a filter to column B, and filter out any 1's to give you a complete list of all your duplicates in column A.
The above formula assumes that you have headings in A1 & B1, and your data begins A2.
I have a table in Excel 2013 that has has thousands of records of food items (Beef-frozen, beef-chilled, beef-brisket, beef-ribs, chicken-fillet, chicken-whole, fish-skinned, fish-whole, yogurt, lettuce-imported, lettuce-frozen, tomato-fresh,tomato, water, milk,...etc) stored in column A. Notice the value may contain other content than the food item name.
I created column B next to column A. I want column B to hold the category of the food item in column A. For example, if A1 has in it "Beef" or "Chicken" or "Fish" then B1 should equal "Meat". If A1 has in it "Tomato" or "Lettuce" or "Onion" then B1 should equal "Vegetable".
What is the best way to achieve it?
Assuming you have column headers, enter this formula in cell B2:
=REPT("Meat",MAX(IFERROR(MATCH({"*beef*","*chicken*","*fish*"},A2,),))) & REPT("Vegetable",MAX(IFERROR(MATCH({"*tomato*","*lettuce*","*onion*"},A2,),)))
This is an array formula and must be confirmed with Ctrl+Shift+Enter.
Now copy B2 and select B3 down as far as you need and paste.
Note: please look closely at the big gap in the middle of the formula. You'll see that this is really two separate formulas concatenated together with an ampersand. You can easily extend this formula in the same way by adding another phrase similar to the first two for a new category. In fact, you could add many more categories in this fashion.
Set up a two column table. Name it, for example FoodTable. Have the first column Named Word (for keyword) and the second column Type, for the type of product. Something like this:
Then, with your data in column A, enter the following formula in B1 and fill down:
=LOOKUP(2,1/ISNUMBER(FIND(FoodTable[Word],A1)),FoodTable[Type])
Results:
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).