Simple VlookUp on MS Excel not working - excel

I am trying to use VLookUp from MS Excel 2010 for the data below:
Basically I want to update the Value of CostA by the Value given in Cost by using the Job Ref but ends up #NA
The formula I paste in cell B4: =VLOOKUP(A4,E3:F4,5,FALSE)
NOTE: The Column A Job Ref is a link but even when I remove the hyperlink the same problem occurs. I have attached the Excel file.
Excel file

The Job Ref number is stored as text. Select cell A4 and (a) click the drop down and select "Convert to Number" or (b) go to edit mode by hitting F2 then press Enter.
Also, your VLOOKUP reference is outside your table. Change 5 to 2.

=vlookup(A4,$E$3:$F$4,2,false)
The $ signs fix the range that your formula is looking in. When your doing more lookups (e.g. have more job references in cells A5, A6 etc), you can just paste the formula down (don't forgot to extend your range).
The 2 means when finding that job ref, return the result from the second column of your data set, with your data set being E3:F4. Because in your initial formula that was a 5, the vlookup was finding the job ref, then it's trying to return the 5th column, but E3:F4 is obviously only 2 columns so it'll return an error.
Hopefully this helps.

Related

Excel365 'Sequence' combined with 'If'

I've created a sequence of dates for a dynamic calender.
This works fine.
But now I want to implement a condition, using 'IF' statement, where the step of the sequence is changed based on the value in the cells in column D (starting in cell D8).
If the cell in column D contains "Y" then the step in the sequence for that specific cell must be 8 in stead of 7.
The idea is that the sequence generates a list of all Mondays of a specific year (defined in B6), but when the Monday is a holiday, the return value must be a Thuesday.
The problem is that the reference for the column (D8) doesn't change and stays on the first cell reference. It should change to D9 for the next sequence value, D10 for the 3rd sequence value, etc.
Dutch formula -
=REEKS(54;1;DATUM($B$6;1;1)-WEEKDAG(DATUM($B$6;1;1);2)+1;ALS(D8="Y";7;8))
English version formula -
=SEQUENCE(54,1,Date($B$6,1,1)-WEEKDAY(DATE($B$6,1,1),2)+1,IF(D8="Y",7,8))
Edit 04/01/2023
This is the first cell in the sequence
This is currently the second cell in the sequence, where reference to D8 needs to be D9
Now I understand your question (in my first answer, I thought you were copying your formula on another place).
There seems to be a difference between earlier Excel versions, where a formula could only have one single cell as a result. Now there are formulae (like =SEQUENCE(), whose answer spreads over different cells. All those cells contain one element of the formula result, which means that the formula itself does not change over the multi-cell result.
I'm not sure if I understand what you mean: I have copied your formula (the English one) in cell "E2" and this is what I get:
=SEQUENCE(54,1,DATE($B$6,1,1)-WEEKDAY(DATE($B$6,1,1),2)+1,IF(D8="Y",7,8))
In another cell ("G3"), this turns into (select cell "E2", press Ctrl+C, press cell "G3", press Ctrl+V):
=SEQUENCE(54,1,DATE($B$6,1,1)-WEEKDAY(DATE($B$6,1,1),2)+1,IF(F9="Y",7,8))
So, when I apply a formula to another cell (two columns further, one row further), the reference to "D8" turns into "F9" (two columns further, one row further).
The other reference ("$B$6) does not change. Obviously, because the dollarsigns prevent that value to be changed (this is exactly what absolute and relative cell references are about, as described here).
Unfortunately, I don't know what you mean when you say that your cell references don't change: the ones, who should, do, and the ones, who shouldn't, don't, which is correct behaviour.
Oh: when you enter your formula in an external tool (like Notepad or so), you paste your formula in a cell and you paste it again in another cell, Excel won't realise that the cell references need to be update, is this the problem you're having?

Index Match Formula Keeps Continuing

I'm trying to create a dashboard, where upon selecting a company from a dropdown list, it will list all of the company's bankers where the data is on another worksheet tab.
So far, the Index Match formula seems to be running fine, however, it keeps on running and lists the bankers from other companies. How can I fix this?
File can be downloaded here: https://drive.google.com/file/d/1fw7yh4AEF1vx3cuG6E_1RBTrTD_k74KD/view?usp=sharing
You can try below approach by pasting below formula in cell E5:
=IFERROR(INDEX(RAW!$D$2:$D$279,SMALL(IF(RAW!$B$2:$B$279=$C$5,ROW(RAW!$D$2:$D$279)-1,10^10),ROWS($A$1:A1))),"")
This is array formula so it needs to be committed by CTRL+SHIFT+ENTER and then copy it down as much needed.
Explanation:
INDEX is retrieves the range reference from the defined GRID based on the row and column reference.
In this particular case, we intend to extract the references sequentially. This is performed by SMALL(IF(RAW!$B$2:$B$279=$C$5,ROW(RAW!$D$2:$D$279)-1,10^10),ROWS($A$1:A1))
Within this formula, first portion is the ARRAY building IF formula as below
IF(RAW!$B$2:$B$279=$C$5,ROW(RAW!$D$2:$D$279)-1,10^10) which tests cells in column B if they match criterion value. If the value matches then ROW reference is returned and if it doesn't then it returns a very large value i.e. 10^10. We subtract 1 from row reference as the data starts from row 2 so it should be (n-1) in principle. This arrangement produces an ARRAY like {1;2;3;4;5;6;7;10000000000....} for value "Acorda".
But we need to pass one element at a time to INDEX formula so this is done by SMALL(IfBasedArray,k) where k part is serially generated by ROWS($A$1:A1) which starts with 1 and increments downwards as the formula gets copied which thus enables INDEX to return desired results.
Finally, when the matches are finished then big number i.e. 10000000000 gets fed and generates an error which then is covered by IFERROR formula to return blank!
Please apply this formula to your sheet's E5 and copy down. Note that I created the named range Coms which refers to RAW!B2:B279.
=IFERROR(IF(INDEX(Coms,MATCH($C$5,Coms,0)+ROW()-ROW(E$5))=$C$5,INDEX(Coms,MATCH($C$5,Coms,0)+ROW()-ROW(E$5)),""),"")
If you prefer, the name in the formula can be replaced with the address, as you had it originally, or you define the named range to expand dynamically.
A simpler option than the 2 previous answers (doesn't require an CSE array entered formula or multiple nested INDEX/MATCHES) would be to have a couple of 'helper' cells in say G5/G6
Start Row would be =MATCH(C5,RAW!B:B,0) This finds the first row on your RAW sheet where the selected company appears
Advisor Count would be =COUNTIFS(RAW!B:B,C5) counts how many rows there are for this particular company
Then your formula in cell E5 becomes =IF(D5<=$G$6,INDEX(RAW!$D:$D,$G$5+D5-1),"") which you can drag down.
screenshot showing formulas/result

Auto Copy and Paste Cell Values not Formula to another Cell

I also need to get your help for the same issue. I need to copy the cell values and not the formulas automatically to the other Cell, "automatically" meaning, I don't need to click, use mouse, or any other means to do that, like once theres a value on that specific cell (which is derived from a formula), the value will automatically be copied and pasted in the other cell (without any intervention from my part) (Only the value is copied not the formula)
Note:
The cell should contain only the copied value and not the formula.
Scenario:
A1 Cell : has 250 value
B1 Cell : has a vlookup formula to search for the value of A1 cell (I need to use VLOOKUP as there's a lot of items in the list, and it is "Dynamic", the reason I cannot just use formula "=A1" to get the value directly)
C1 Cell : Needs to copy and paste only the plain value from B1 cell which is 250, not including the vlookup formula, it should be automatically copied without any intervention (Cannot use VBA code / Macro as it will be run in excel online)
Thanks!!
Just use abasic Excel formula.
Example:
The source data is in cell A1.
You want to copy the same value to cell B1.
In cell B1 write:
=A1
That is all.
Additionally, you need to configure correctly the strategy for calculating the formulas:
I managed to find a solution, sharing as might help someone in the future, just needed to use =value(A1), instead of just "=A1", when I did this, the chart can read the values as it is and not the formula behind it. Found another work around as well, by using the formula =A1+0, for some reason this works too. –
=value(A1) works perfectly , If that formula contains a % figure , simple We can multiply by 100 to get the correct value.

Turn off pop-up errors/alerts in MS Excel 2010

I have a table of results in MS Excel 2010 with formulas in each cell that I need to edit. I have INDIRECT cell references in the formulas that do not update when copied to other cells. So, I believe the easiest way in this case for me to edit all the formulas in the table is with two find-and-replaces (changing the beginning and end of each formula to have what I need). However, when I try to do the find and replace, Excel shoots a "The formula you typed contains an error" pop-up at me and refuses to execute the replace. I know there's an error, I'm not finished with the formula yet! So:
1) How can these errors be disabled?
2) Is there a way to make indirect cell references update the way a normal cell reference would (eg. make INDIRECT("'"&F5&"'!L7") update L7 to L8 in the next row) so that I can copy the new formula throughout the table of results, and avoid the find-and-replace entirely?
Sorry guys, I realize this is a somewhat strange question for stackoverflow.
1) I don't know.
2) I'm not 100% sure from the question, but I can think of two scenarios:-
(a) You have a list of references which your INDIRECT formula uses, and you want it to select each one in turn as you pull the formula down. This is trivial so it's probably not what you meant:-
=INDIRECT(A$1&"!"&A2)
assuming your sheet name is in A1 and the references are in A2,A3 etc.
(b) You have a reference to the beginning of a range of cells in sheet2, and when you pull the INDIRECT formula down, you want it to automatically get the next cell in the range:-
=INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(INDIRECT($A$2)),4,1,$A$1),"1","")
&(ROW(INDIRECT($A$2))+ROW()-ROW($C$2)))
where this formula is placed in cell C2 and pulled down.
The idea is that you break the cell reference down into its column name (using the excellent suggestion here ) and its row number, then get the row number to increment using the ROW function.
Sheet 2:-
Sheet 1:-

Getting formula of another cell in target cell

How does one cell obtain the formula of another cell as text without using VBA? I can see this question has already been asked many times and the answer is always to write a custom function in VBA.
However, I found a post made in 2006 which claimed to have found the non-VBA solution but the link provided in that post is already broken.
=FormulaText(Reference) will do the trick Documentation
There is nice way of doing this without VBA. It uses XL4 macros (these are macros, but it is not VBA, as asked).
With reference to the figure 1, cells A2:A4 contain usual formulas.
Going to Formulas -> Define Name, I defined two named ranges (see fig. 2), with the information shown in cells A6:B8.
Enter in cell B2 =FormulaAsText. This will retrieve the formula in cell A2 as text.
Explanation:
The named range FormulaAsText uses =GET.CELL(info_type,reference). In this case, ìnfo_type = 6 retrieves the formula, and reference = OFFSET(INDIRECT("RC",FALSE),0,-1) uses the cell with 0 rows and -1 columns offset from the one the formula is used in.
Copy B2 and paste into B3:B4. This will show formulas in A3:A4. Cell A4 shows that the worksheet function CELL only retrieves values, not formulas (as opposed to GET.CELL).
Since FormulaAsText gets the formula from a cell at fixed offset (0,-1) from the current, I defined another range FormulaAsText2, which uses an offset (rows,cols) read from the worksheet itself. Cells D2:D4 contain =FormulaAsText2. Thus, cell D2 shows the contents of cell B3 (=OffSET(D2,1,-2)), which is FormulaAsText. cells D3:D4 show the contents of themselves. This adds some flexibility. YMMV.
PS1: The essence was taken from
http://www.mrexcel.com/forum/excel-questions/20611-info-only-get-cell-arguments.html
PS2: Tim Williams mentioned in a comment "the old XLM GET.FORMULA()". This answer is possibly related (not the same, since this one uses GET.CELL()).
PS3: A simple VBA solution is given, e.g., in
http://dmcritchie.mvps.org/excel/formula.htm
EDIT: Complementing this nice answer, the worksheet function FormulaText is available for Excel 2013 and later.
This suggestion may be helpful for those who after retrieving a block of formulas and transporting them to a new spreadsheet want to put them to work again. Excels FORMULATEXT function is great for picking up formulas but it leaves them as unusable text strings. If you want to get them back as fully functioning formulas you have to edit each one individually to remove the string character, but here is a shortcut for larger blocks.
Get to the position where you have the required formulas as text (in other words after using FORMULATEXT - you have done a copy and (value only) paste). The next step involves highlighting all the cells you want to convert and then navigating to the [Text-To-Columns] menu option ({Data} bar on Excel 2016). You can select 'Delimited' but on the next screen just make sure you de-select any marks that do appear in your formulas. Then 'Finish'. Excel should automatically analyse the cells as containing formulas and you should now have them working again.
There is a way to do this. In my example I had a table that showed a date. The date comes from Sheet!G91. In my table I also had a column that showed the sheet name. I added two more columns to my table. The first column had column(Sheet!g91), which returns the number 7, because G is the seventh letter in the alphabet. I then converted the number to a letter (G) using another table in my workbook. In the second column that I added, I made a formula row(Sheet!G91), which returns the number 91. Note: Row and Column may appear as volatile formulas, which recalculate with every calculation of the workbook.
I wanted another column to show the formula contents of the date cell mentioned at the beginning of this post. I included the following string function (you can also use CONCATENATE).
"=" & AJ9 & "!" & AM9 & AN9
The items separated by ampersands get strung together (that is, concatenated). AJ9 in my example contains the sheet name, AM9 contains the column letter, and AN9 contains the row number.
I now have a column that dynamically updates its contents to reflect the sheet name and cell reference. The results in my workbook cell are
=Sheet!G91.
You can't. This is most likely a design choice to eliminate an average Excel user from accidentally getting something they did not want.
What you are reading is correct - writing a UDF is the solution you want.

Resources