I have cells A1-A7 with A1 needing the formula. Cells A2-A7 have dropdown list options of "Y" or "N". What I'm needing is for A1 to remain blank until a "Y/N" option is chosen for cells A2-A7. Once A2-A7 have data (Y or N) I need them to be evaluated so that if there is a "N" in any cell of A2-A7, then A1 will display "N". If no "N" is input in A2-A7, then A1 will display "Y"
The formula I'm currently using in cell A1 is:
=IF(COUNTBLANK(M3:M7)>0,"",(IF(AND(M3="N",M4="N",M5="N",M6="N",M7="N"),"N","Y")))
This formula is keeping the A1 cell blank no matter what is input into A2-A7. Any ideas?
There's several ways to do this, but the one first coming to mind for me is to rewrite the second part of your formula.
Keep this part, to check if you have all of your cells filled out
IF(COUNTBLANK(M3:M7)>0,"",
Then, I'd use the same method for finding out if any of the cells hold the value "N"
IF(COUNTIF(M3:M7,"N")>0;"N";"Y")
This is a personal choice, but I find reading the code is easier if you use versions of the same function like this.
The whole code would then be
IF(COUNTBLANK(M3:M7)>0,"",IF(COUNTIF(M3:M7,"N")>0,"N","Y"))
PS: I saw in the comment someone suggested splitting the original formula up in different cells to figure out where it goes wrong. There's also a built-in function that allows you to calculate a formula step-by-step and see the results. It's called Evaluate Formula and can be found under the Formula section.
With the special character '$' I can prevent an Excel formula from changing its reference when the cell itself is copied (e.g '$A$1').
But is there also a special character that prevents an Excel formula from changing its reference when the referenced cell is moved?
Here's an example:
I have:
Now I move the cells 'A1:A3' down one row. So the formulas in the cells 'C1:C3' change:
But I don't want that the formulas in the cells 'C1:C3' change. They should remain unchanged:
Try formula:
=IF(INDEX(A:A,ROW(1:1))=INDEX(B:B,ROW(1:1)),"Same","Not same")
the formula always work, regardless of any column been delete besides columns A or B
If you always want to refer to A1, then you can't just use A1 as a reference, because, as you have seen, Excel will adjust that reference if rows are inserted above.
Instead, use Index(A:A,1) . That will always return the value from the first row of column A.
=if(index(A:A,1)=index(B:B,1),"same","not")
Edit after comment: If this does not suit your purpose, maybe you need to redesign your spreadsheet so that the position of things does not change all the time. This looks like you are adding new data at the top of a list.
Excel works from top to bottom and things will be a lot easier if new data is added at the bottom of a list. You can always use other Excel tools to change the sort order if you want to have the data sorted in reverse chronological order.
Use formula in C1:
=IF(INDEX(A:A,ROW(ZZ1))=INDEX(B:B,ROW(ZZ1)),"Same","Not same")
and copy down.
It's probably a simple problem, but I did not even know the keywords to google it ;/. Let's say I have this data :
Now I also have this litle formula:
If I know drag the C cell to the right, Excel will attempt the following caluclation:
=2+B1
What I want him to do is to attempt this calculation
=2+A2
Of course the easiest solution would be to store my initial data in one row instead of 1 column, but it is really inconvenient for me. Thanks for any help
You can use the indirect() method to reference a cell by it's "String identifier", i.e. "A3". When filling out to the right, use CONCATENATE() and COLUMN() to create your String identifiers {A1,A2,A3,A4,A5...} as required:
=2+INDIRECT(CONCATENATE("A";COLUMN()-2))
This will result in the following:
Side-Node: If you want this for some x/y-Grid-Generation, you can also be lazy,
and just insert =COLUMN() for every cell from "A1 - Z1" and ROW() for every cell from "A2 - A24".
(Or even avoid these at all and directly perform your actual calculation by using column() and row() as replacement for your x/y.
You may try using a combination of the INDIRECT and COLUMN functions:
=2+INDIRECT("A"&(COLUMN()-2))
You would paste the above formula into cell C1, and then drag across to the right however many columns/rows you wanted to cover.
This would result in the following:
This works because COLUMN()-2 returns 1 for the C column, 2 for the D column, and so on. Therefore, the formula will be calling INDIRECT on A1, A2, etc. for column C, D, and so on.
In general, if you want relative references to move down as cells are dragged to the right, you can use this:
Instead of:
= 2+A1
Do:
= 2+INDEX($A:$A,COLUMN()+<offset>)
Where <offset> is whatever offset you need. The offset will change depending on which column the starting formula is located in.
INDEX should be preferred over INDIRECT because INDIRECT is volatile (must recalculate after any change to the workbook) but INDEX is not (only recalculated when one of the inputs the formula, in this case $A:$A, changes).
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.