I wanted to compare value in cell A1 and B1.
However, sometimes PC give different value as cell B1.
Initial code I've been writing is as below in cell C1:
=IF(ISERROR(MATCH(A1,$B$1:$B$5,0)),"","Duplicate")
This code only compare exact value. Thus, I'm trying to add LEFT Function into function above:
=IF(ISERROR(MATCH(Left(A1,8),$B$1:$B$5,0)),"","Duplicate")
But above function only count character in A1 only. How do I add LEFT(B1,8) to also read value in cell B1?
Thanks.
Regards,
Zaiem
Maybe what you would like is:
=IF(MAX(IFERROR(FIND(LEFT(A$1,8),B$1:B$5),""))=1,"Duplicate","")
entered with Ctrl+Shift+Enter
Related
Suppose there is an empty excel sheet. Enter formula "=A1" into the B1 cell. The value of B1 would be 0.
My question is: why the value of B1 becomes zero when referring to an empty cell A1? Any rationales Excel behaves this way?
Thanks.
That is because the formula in B1 returns the value of cell A1.
Excel assigns the value 0 to a blank cell.
To distinguish 0 from blank, in B1 enter:
=IF(A1="","",A1)
FWIW, force a zero-length string with =A1&"". This can also be used to show (an apparently blank) cell when a VLOOKUP of INDEX/MATCH wants to return a zero after encountering a blank cell to return. Two caveats: first, a zero-length string is not truly blank and second, if used with VLOOKUP(...)&"" then any true number that should have been returned as a true number becomes text-that-looks-like-a-number. – Jeeped
Quoting the best answer so I can vote on it :)
I changed my application to =formula&"" according to Jeeped, and works great. Kinda dumb that Index returns Value(formula).
I am trying to find how to get an excel formula to get a cell's relative reference into a cell.
A formula that would be like =getcellreference(B2) and then has B2 as the output.
Nothing complicated but i could not find a simple solution.
You can use CELL():
=CELL("address",B2)
For formatting to literally show B2 instead of the absolute reference, you can do:
=SUBSTITUTE(CELL("address",B2),"$","")
If all you are trying to do is output a cell reference that you manually input, then all you need to do is:
="B2"
or
B2 (no equals sign)
You can use the ADDRESS function to obtain the address of a cell in a worksheet, given specified row and column numbers
ADDRESS(row_num, column_num, [abs_num], [a1], [sheet_text])
So for cell B2, you will need to put =ADDRESS(2,2) where the first 2 stands for the row number and 2nd is for column B.
Use formula to sum cells which is reference of another cell
My requirement:
Note: Inside bracket is the formula that particular cell holds
A1(=Sheet1!A1) ==> 6
A2(=Sheet1A2) ==> 2
A3(=Sheet1!A3) ==> 2
A4 (=SUM(A1:A3)) ==> 0 (is what I am getting) but I need A4=10
Help me out with this.
As mentioned by #Scott, one of your cells probably contains a number stored as text.
To check try either selecting all the cells and setting the format or troubleshoot which cell(s) is(are) causing the problem.
=SUM(VALUE(A1),VALUE(A2),VALUE(A3))
This will convert each cell to a numeric value. If that works then start swapping out the value function for just the cell reference (e.g. -Value(A1) becomes simply A1) and see which cell breaks the sum function. Once you find that cell you can wrap whatever formula is in that cell in the value function to force it to store the numeric value.
I am posting this question because I had a hell of a time trying to find the answer myself.
Basically I have a cell that references a cell that references another cell with some data in it. For example, A3=A2 and A2=A1 and cell A1 contains the text Hello. So cell A2 and A3 also contain the same text. See picture below:
But let's say I actually want cell A3 to show data relative to the cell position that A2 is pointing to (Remember A3=A2). I need to use the OFFSET function to do this and one would think that A3=OFFSET(A2, 0, 1) might work (click here to see how OFFSET works). But OFFSET does not work by itself. It would return the data from the cell to the right of cell A2 (shown below), instead of realizing that A2 points to A1 and then returning the data to the right of A1.
So how then do we get cell A3=B1, indirectly, by going through cell A2?
We need to use a combination of functions, one of which is INDIRECT. click here to see how INDIRECT works. So in order to use INDIRECT we need the text found in cell A2. The FORMULATEXT function (more info) will extract =A1 from cell A2 when used like so in cell A3:
A3=FORMULATEXT(A2), shown below:
Now we just need to strip off the = from the text so that we have an actual text reference that INDIRECT can use. You can do this using either the RIGHT or MID functions (right, mid) in combination with the LEN function (length). You need LEN if the number of rows in your sheet goes from single digit numbers into double digits, and so on. You also need to pass in the FORMULATEXT function again so it can compute the length of the text =A1. If you don't, it will compute the length of Hello. You also need to be aware that LEN()-1 is the correct length you need, since you are throwing away the = from the text.
For example: A3=RIGHT(FORMULATEXT(A2),LEN(FORMULATEXT(A2))-1) giving us:
Put it all together and you can OFFSET the cell that A2 references from A3 with INDIRECT like so:
A3=OFFSET(INDIRECT(RIGHT(FORMULATEXT(A2),LEN(FORMULATEXT(A2))-1)),0,1)
I have 2 worksheets: Summary and SERVER-ONE.
In cell A5 on the Summary worksheet, I have added the value SERVER-ONE.
Next to it, in cell B5, I would like a formula that uses the value in A5 to display the value of G7 in the worksheet of the same name (SERVER-ONE).
I could manually use:
='SERVER-ONE'!G7
However I would like this to be dynamic, so I can easily add more worksheets.
I tried the obvious with no joy:
='A5'!G7
Any suggestions?
You can use the formula INDIRECT().
This basically takes a string and treats it as a reference. In your case, you would use:
=INDIRECT("'"&A5&"'!G7")
The double quotes are to show that what's inside are strings, and only A5 here is a reference.
You need INDIRECT function:
=INDIRECT("'"&A5&"'!G7")
not sure if you solved your question, but I found this worked to increment the row number upon dragging.
= INDIRECT("'"&$A$5&"'!$G"&7+B1)
Where B1 refers to an index number, starting at 0.
So if you copy-drag both the index cell and the cell with the indirect formula, you'll increment the indirect.
You could probably create a more elegant counter with the Index function too.
Hope this helps.
Here is a solution using INDIRECT, which if you drag the formula, it will pick up different cells from the target sheet accordingly. It uses R1C1 notation and is not limited to working only on columns A-Z.
=INDIRECT("'"&$A$5&"'!R"&ROW()&"C"&COLUMN(),FALSE)
This version picks up the value from the target cell corresponding to the cell where the formula is placed. For example, if you place the formula in 'Summary'!B5 then it will pick up the value from 'SERVER-ONE'!B5, not 'SERVER-ONE'!G7 as specified in the original question. But you could easily add in offsets to the row and column to achieve the desired mapping in any case.
By using the ROW() function I can drag this formula vertically. It can also be dragged horizontally since there is no $ before the D.
= INDIRECT("'"&D$2&"'!$B"&ROW())
My layout has sheet names as column headers (B2, C2, D2, etc.) and maps multiple row values from Column B in each sheet.
INDIRECT is the function you want to use. Like so:
=INDIRECT("'"&A5&"'!G7")
With INDIRECT you can build your formula as a text string.
Guess #user3010492 tested it but I used this with fixed cell A5 --> $A$5 and fixed element of G7 --> $G7
=INDIRECT("'"&$A$5&"'!$G7")
Also works nested nicely in other formula if you enclose it in brackets.
This will only work to column Z, but you can drag this horizontally and vertically.
=INDIRECT("'"&$D$2&"'!"&CHAR((COLUMN()+64))&ROW())