I want to check if the list in Column A contains only products from the list in Column B.
If yes in Cell D1 the value = yes
If not in Cell D1 the value = no
As cou can see in the example above Product C and Product E do not exist in the list in Column B, therefore the value in Cell D1 is no.
So far I was able to figure out this formula =IF(ISNA(VLOOKUP(A1;$B$1:$B$5;1;0));"No";"Yes").
However, I would have to add a helper column with this formula to each row next to Column A.
Is there a solution that solves the issue with one formula in in Cell D1?
A basic formula might be
=SUMPRODUCT(COUNTIF(A1:A10,B1:B10))=COUNTA(A1:A10)
or more dynamic
=SUMPRODUCT(COUNTIF(A:A,B1:INDEX(B:B,COUNTA(B:B))))=COUNTA(A:A)
These can be wrapped in an if statement to give "yes" or "no":
=IF(SUMPRODUCT(COUNTIF(A1:A10,B1:B10))=COUNTA(A1:A10),"yes","no")
=IF(SUMPRODUCT(COUNTIF(A:A,B1:INDEX(B:B,COUNTA(B:B))))=COUNTA(A:A),"yes","no")
Related
I need to compare the date of a cell against a column that has multiple date and I see which one it matches and get the associated value. Here I put an image to explain myself better:
Column D is where I need to put the formula, which compares the dates in column A on sheet 1 with the dates in column A on sheet 2. If it matches, I need to multiply the values in column C on sheet 1 by the values in column B of sheet 2.
Here another image with an example to be clearer
I have a little idea that would be something like:
= YES (ERROR (MATCH (Sheet1! A4; Sheet2! A2: A32; 0)); Sheet1! C4 * X
In the x it should go B3, but I don't know how to get that cell in the search above.
Try this:
=VLOOKUP(A3,sheet2!A:B,2)*C3
I have recreated your spreadsheets below.
I am trying to check whether the value in each cell within Column A is in Column D. Some cells in Column D have multiple values within a single cell. If the value of Column A IS found in Column D then I want the formula to return what's in Column B (value next to Column A that matched).
Try:
Formula in C2:
=IF(SUMPRODUCT(--(ISNUMBER(SEARCH(A2,$D$2:$D$5))))>0,B2,"")
Drag down..
If you are looking at just row by row analysis then try this:
=if(iserror(search(a2,d2)),"",b2)
if you are trying to match any row in D then I suggest breaking out all items in D into an item per row and then doing a VLOOKUP
Can you copy column B to Column E? If so,
=Vlookup("" & A1 & "", D:E, 2,0) and scroll down.
If not, a similar index(match( function will work with a wild card. (*)
I'm using a vlookup to look for the all cells in the column D and see if they got a positive match in the C cells. If yes, I'm putting what is in the B cell next to the C cell.
In the example below, E2 will have what is inside of B2 after a lookup on D2 in the C column.
I've tried this formula but it is not the good one
=VLOOKUP(D2,C:C,0,FALSE)
I hope I don't need VBA
Best.
It is not completely clear exactly what you are looking for. I think you are trying to lookup data in column B based on a key in column C. If so what you want to use is
=INDEX(B:B,MATCH(D2,C:C,0))
As a breakdown, the MATCH will return a number representing which row within the range C:C matches the key D2. And, INDEX returns the element in B:B at row MATCH(D2,C:C,0).
Hi I'm a complete noob to excel and looking to do something like this:
For each item in column A
Get its corresponding value in column B and populate in column D
get its corresponding value in column C and populate in column E
the main problem I'm having is the number of rows in each column may differ.
I think I would need a macro to do this.
How could I do this in Excel?
If you don't want to resort to a macro and the presence of something in column A dictates when you want to see something in column D & E, then consider the following functions:
IsBlank( A1) returns true if A1 is empty else false.
If( condition, trueResult, falseResult) returns the corresponding result based on the condition.
So for example, you could write the formula for D1 to be:
=If( IsBlank(A1), "", B1 * 2)
would set D1 to be twice that of B1. You can now copy and paste that formula down the D column to as far as you need and because the formula uses relative addressing (B1 instead of $B$1) the formula is updated for each cell to work on the corresponding row.
If this doesn't solve your issue then more detail on your problem would be useful.
How to solve this case:
Suppose there are two columns having same text assigned with values then i need to subtract those values to get the result in a new cell
For eg: if james in cell a1 has been assigned value as 20 in cell b1 and also james in cell c2 has been assigned value as 40 in cell d2, then i need to get the result as (40-20=20) in a different cell such that while giving the formula the James in cell a1 and c2 has to be same and only there corresponding values get subtracted and not with any other cell.
Please help me on this.
I find it a little strange that you would be starting with C and subtracting A, but okay. If what you are doing is looking for a name in C and taking the number in the right column then subtracting that from the value to the right of the same name in A, then VLookup has you covered:
=VLOOKUP("james",C:D,2)-VLOOKUP("james",A:B,2)
You can also use a formula based on INDEX and MATCH, which doesn't require cells to be sorted (as VLOOKUP does):
=INDEX(B:B; MATCH("James";A:A;0)) - INDEX(D:D; MATCH("James";C:C;0))
If either A:A or C:C doesn't have a "James", then the formula will return #NA. You can avoid this by adding a conditional to check whether the match is valid.
For example, if column C might not contact "James", replace
INDEX(D:D; MATCH("James";C:C;0))
with:
IF(ISNA(MATCH("James";C:C;0)); 0; INDEX(D:D; MATCH("James";C:C;0)))
which will then return 0 if there is no James in column C, otherwise the corresponding value in column D will be returned.