I am editing this entire thing because I feel I can be more clear now, and I think this question can be very useful for a lot of people:
Original image here: http://i.imgur.com/Givg96T.png?1[/img]
I guess I can't post a picture, so here is a link to what I am referencing.
Based on the shown formula, Cell D1 says compliant because it found the referenced text (B1) in the cited range column (D). This is fine, I get how to do this part. The problem is that I want it to say compliant only if it finds that text, which it did, AND ALSO has a Y next to that particular cell in column G, not a N as shown. So ideally it would say 'not sufficient' rather than compliant, because although it found the next, there is an N next to it, not a Y. This needs to apply to a range and not just one row as there will be many rows of this same data.
Essentially the question I want cell D1 to answer is this: Do you find anything that says the contents of cell B1 in column D? And if so, is there a Y next to it in column G? If the answer is yes to both of those questions, say "compliant". If not, say 'Not sufficient'.
Thank you to anyone who can offer any advice, I greatly appreciate it.
You need to use IF and AND both in this case.
You can try the formula (assuming value starts from row 1):
=IF(AND(F1="international stock",G1="Y"),"Yes","No")
Put it in cell H1 and drag to the end of rows in column H.
For the demo purpose I have put "Local stock" as well.
Hers is the screenshot.
-----------------------------------------------------------------------------------------------
EDIT (Based on comment):
-----------------------------------------------------------------------------------------------
So in order to search in whole column, you will first have to create a name range for column F and G so it will make your life easier.
Formulas -> Name Manager -> Create new -> give name RngF (for column F) and give the formula:
=OFFSET(Sheet1!$F$1,0,0,COUNTA(Sheet1!$F:$F),1)
Same way create another and give a name RngG and give formula:
=OFFSET(Sheet1!$G$1,0,0,COUNTA(Sheet1!$G:$G),1)
You may need to change the "Sheet Name".
Then you will combine IF, AND, MATCH, INDEX formulas and Array to get what you want.
Basically,
MATCH will tell you the cell number if "International stock" is present in column F.
INDEX will give you the cell value based on the references.
And in final formula, you will combine them altogether like this:
=IF(AND(MATCH("International stock",RngF,0)>0,INDEX(RngG,MATCH("International stock",RngF,0))="Y"),"Yes","No")
Make sure you hit Ctrl + Shift + Enter. This will make the formula to run in entire array that you've passed using name range. So it should look something like:
{=IF(AND(MATCH("International stock",RngF,0)>0,INDEX(RngG,MATCH("International stock",RngF,0))="Y"),"Yes","No")}
I have been breaking my head over this formula for sometime now. I have found a solution which is too big and not so convenient to use every time. So can any Excel Expert give me a solution/suggestion?
Column A contains 150 values. Column D to R contains a table in which I need to look up the values in A one by one. I want to return address of all the cells that contains the value.
For example, Value in A2 is present in cells D5, E15, H10, R3 then my result should be D5,E15,H10,R13.
Please Note that some columns may not contain the value of A2, I do not want them displayed.
Here is the formula I have written:
=CONCATENATE(
IF(A2=IF(COUNTIF(D:D,A2),VLOOKUP(A2,D:D,1,FALSE),""),ADDRESS(MATCH(A2,D:D,0),4,4),0),",",
IF(A2=IF(COUNTIF(E:E,A2),VLOOKUP(A2,E:E,1,FALSE),""),ADDRESS(MATCH(A2,E:E,0),5,4),0),",",
IF(A2=IF(COUNTIF(F:F,A2),VLOOKUP(A2,F:F,1,FALSE),""),ADDRESS(MATCH(A2,F:F,0),6,4),0),",",
IF(A2=IF(COUNTIF(G:G,A2),VLOOKUP(A2,G:G,1,FALSE),""),ADDRESS(MATCH(A2,G:G,0),7,4),0),",",
IF(A2=IF(COUNTIF(H:H,A2),VLOOKUP(A2,H:H,1,FALSE),""),ADDRESS(MATCH(A2,H:H,0),8,4),0),",",
IF(A2=IF(COUNTIF(I:I,A2),VLOOKUP(A2,I:I,1,FALSE),""),ADDRESS(MATCH(A2,I:I,0),9,4),0),",",
IF(A2=IF(COUNTIF(J:J,A2),VLOOKUP(A2,J:J,1,FALSE),""),ADDRESS(MATCH(A2,J:J,0),10,4),0),",",
IF(A2=IF(COUNTIF(K:K,A2),VLOOKUP(A2,K:K,1,FALSE),""),ADDRESS(MATCH(A2,K:K,0),11,4),0),",",
IF(A2=IF(COUNTIF(L:L,A2),VLOOKUP(A2,L:L,1,FALSE),""),ADDRESS(MATCH(A2,L:L,0),12,4),0),",",
IF(A2=IF(COUNTIF(M:M,A2),VLOOKUP(A2,M:M,1,FALSE),""),ADDRESS(MATCH(A2,M:M,0),13,4),0),",",
IF(A2=IF(COUNTIF(N:N,A2),VLOOKUP(A2,N:N,1,FALSE),""),ADDRESS(MATCH(A2,N:N,0),14,4),0),",",
IF(A2=IF(COUNTIF(O:O,A2),VLOOKUP(A2,O:O,1,FALSE),""),ADDRESS(MATCH(A2,O:O,0),15,4),0),",",
IF(A2=IF(COUNTIF(P:P,A2),VLOOKUP(A2,P:P,1,FALSE),""),ADDRESS(MATCH(A2,P:P,0),16,4),0),",",
IF(A2=IF(COUNTIF(Q:Q,A2),VLOOKUP(A2,Q:Q,1,FALSE),""),ADDRESS(MATCH(A2,Q:Q,0),17,4),0),",",
IF(A2=IF(COUNTIF(R:R,A2),VLOOKUP(A2,R:R,1,FALSE),""),ADDRESS(MATCH(A2,R:R,0),18,4),0))
As I said, this works but I am looking for a simpler and smaller formula.
Hint: Maybe using array can help?
Thanks in advance :)
What you are trying to accomplish is not a great fit for Excel formulas, but it can be done with a smaller, simpler formula dragged across 15 columns instead of 1 giant complicated formula that tries to do everything at once.
Assuming column A has 150 values (from A1 to A150), and there is a table going from D1 to R50...
Enter =S1&IFERROR(","&ADDRESS(MATCH($A1,D$1:D$50,0),COLUMN(D1)),"") into T1.
Drag the formula across to AH1.
Enter =RIGHT(AH1,LEN(AH1)-1) into AI1.
Select T1 to AI150 and press Ctrl-D.
Column AI1 will contain the results you are looking for.
How does this work?
The formula in T1 begins by taking the result of one cell to the left (which is blank). Then it concatenates this with the address of the first match in column D (prefixed by a comma). If there is no match, it just concatenates blank (""). As you drag this formula to the right, it keeps concatenating addresses as matches come up (or blank if there are none). When you get to the end, you will have looked for matches in all 15 column of your table.
The formula in AI1 just strips off the initial comma if there is one.
I am trying to have the values that my vlookup function returns act as a hyperlink that will go to the value it pulled from another sheet in the same workbook.
There are thousands of lines that I need to hyperlink and I can't go one by one, right clicking and manually changing them.
If anyone has advice to solve this problem, please let me know. Below is my vlookp formula.
=VLOOKUP(A:A,'Cost Estimates'!A:C,3,FALSE)
To list address of the matching cell, you can do this:
=ADDRESS(MATCH(A1,'Cost Estimates'!A:A),3,1,1,"Cost Estimates")
But this won't create a hyperlink, just a visible address.
You can use:
=VLOOKUP(A1,'Cost Estimates'!A:C,3,FALSE)
to return the column C value corresponding to A1.
Then use:
=MATCH(VLOOKUP_RETURN,C:C,0)
to get the index of that in column C.
Then use:
="#'Cost Estimates'!C"&INDEX_VALUE
to build a hyperlink address.
Finally, you can use HYPERLINK to construct the hyperlink. Putting it all together in a single formula:
=HYPERLINK("#Cost Estimates!C"&MATCH(VLOOKUP(A1,'Cost Estimates'!A:C,3,FALSE),'Cost Estimates'!C:C,0),VLOOKUP(A1,'Cost Estimates'!A:C,3,FALSE))
Hope that does the trick.