Excel formatting for making values equal - excel

I am working in Excel and I am wanting to find out if there are matches in one sheet based on a list in the other sheet.
I have pasted the values in a list and want to return their corresponding value from another sheet. The cells that contain letters and numbers work correctly (example: D5765000), but for some reason if the cell has only numbers, Excel is not able to find it in the other sheet, even though it exists.
I pasted a value 745‐3000 in the list and I am looking for this corresponding value in another sheet. It shows as #N/A on the lookup indicating it doesn't exist in the other sheet. However, if I delete the 745‐3000 and manually type 745-3000, then Excel somehow does recognize the value and find it in the other sheet.
The formatting is exactly the same in both and there are no spaces in either list. I cannot understand why Excel won't recognize the pasted value of 745-3000. Any ideas?

Excel is reading the "-" with a different code than it is with a manually typed "-"
Isolate the "-" and use to find and replace. Does some data contain multiple offending "-"'s?
=REPLACE(H4,FIND(G4,H4),1,"-")
EDIT: Switched from code to Unicode
TY #ron
We find the offending char using the set up pictured below:
Some of the formulas used:
Yellow Cells:
=UNICODE(MID($A$3,C4,1))
Light Blue Cells:
=UNICODE(MID($E$3,C4,1))
At the bottom we check to see what code we get from the value. I get a VALUE mark with from the unicode value of "-"

Related

Find and Replace by referencing another cell formula

I am trying to write a code that is like find and replace within formulas. Essentially, I have all these cells that reference other workbooks yet the same cells. I need a code that replaces the middle terms which begin after the first 18 characters and end where there is a "]" and then is replaced by a specific cells value that is referenced. For ex. the original cells formula is
=userbush/dropbox/dallasloop[garden.xlsm]Profit!k!5!
and I want to replace that formula with
=userbush/dropbox/dallashouse[kitchen.xlsm]Profit!k!5!
That being said I have a cell that has dallashouse[kitchen.xlsm so that input cell can by dynamic and changed. In all, I am trying to create a code the finds and deletes certain character between two constraints and replace it with values that are within a referenced cell.

Excel, VBA, VLookup text value with and without apostrophe

After hours of trial and error, I've determined that doing an Application.Vlookup for a text string in a range returns:
Error 2042 if the text in the search range isn't preceded by an apostrophe
Returns a value in the search range if the text is preceded by an apostrophe
Both search variables are type 8, string, but only the range value with the apostrophe is considered equal, even though the string being searched for, does not have an apostrophe in it.
Is there a way to have Vlookup consider text without an apostrophe equal? And no, I'd rather not have to add an apostrophe to everything.
Thanks in advance.
PS Made a small program, using a different version of Excel but still getting undesired results...
Excel Program and VLookup results
Excel Macro and it's results
In the spreadsheet, all the number values were entered by keyboard.
Then used the format cells option to change them to text.
Then added an apostrophe to the second text value '478901' as denoted by the green triangle, top left-hand corner of the cell.
Vlookup in C2 does not recognize A2 as text, even though it has been formatted as such.
Vlookup in C3 does recognize A3 as text and provides the returned value in column 2.
In the macro, the output pretty much says it all.
myData range is confirmed by address call.
VarType calls for values in A2 & A3 confirms excel is treating them as Double-precision floating-point number (5) and String (8), even though both have been formatted to text, although I suspect this is just for display purposes now.
The Application.Vlookup calls for the values in A2 and A3 return same as spreadsheet Vlookup calls.
In my earlier post, I said that both vartypes returned string (8) but that only the one with the apostrophe worked. This was with the work version of excel, which is earlier than this one. So it looks like someone tried to fix this issue or it just ended up different without attention. Either way, something is broken. "444" doesn't equal "'444" except in excel and "444" equals "444" everywhere else but in excel.
Looks like I'll need to test for both.
You've formatted the worksheet cells as "Text", but if you do that after the value has been entered it does not "take": cell contents will be by default left-aligned, but the values are still numeric for the purposes of formulas etc.
Your value with the ' prefix works in the lookup because it's actually text: if you re-enter the values in the "text format" cells (no need to add the apostrophe) then those will also become non-numeric and will be matched by the vlookup.
Eg see below - first 4 rows are "General" format for "Value"; next 4 rows are formatted as "Text" (after the values had been entered).
501 and 506 are both not recognized as numbers because they have a ' prefix.
504 was re-entered after the Text cell format was applied, and so is seen as non-numeric.
505 and 507 are both still seen by Excel as numbers.
Related: https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_winother-mso_2010/a-number-formatted-as-text-is-really-a-number/085bb189-342b-4eed-bc33-2f149c6db244

VLOOKUP not working in excel for MAC 2011

I have a problem when using VLOOKUP in excel for MAC 2011. I am looking up for a value two column in different sheet, Column A is the one I want to check, Column B is the reference.
=VLOOKUP(A1, Sheet2!$A$1:$B$1000,2,0)
Some of boxes in Column A get a value return, but the other cannot. For those which cannot, when I retype the words inside the box, and I get the value returned.
I try to copy the Column A and selectively paste with value only, but those cannot get a returned value remained the same.
I guest there is something wrong with the format, but I cannot fix it. Please help.
Seems likely an issue with trailing spaces. With or without in the Table-array can be handled by adapting your formula to:
=VLOOKUP("*"&A1&"*",Sheet2!$A$1:$B$1000,2,0)
(provided you don't have something like manifestation as well as station in ColumnA!).
If your source data has leading or trailing spaces that your Table_array does not then the recommended solution is to remove those by a formula such as:
=TRIM(A1)
copied down to suit and then that array inserted back to A1 with Paste Special, Values.
Another possibility is that you may be trying to match a value to text that looks like a value (or vice versa).

Copying cells from one worksheet to another if a column matches a value

I'm trying to use formula to copy data from one worksheet to another where a column matches a certain value.
To be more specific, I want Working!A2:E100 to contain Data!A2:E100 but only for those rows where Data!C2:100 contains the value "Fixed".
Doing this with leaving blank rows is simple, I just create the formula:
=IF(Data!$C2="Fixed", Data!A2, "")
And copy that formula across all the cells.
But then I thought I'd get clever and have it not copy across blank lines, and entered a maze of unclear excel tutorials and vague error messages.
I've created this formula:
=INDEX(Data!A2:Data!A200, MATCH("Fixed", Data!$C$1:Data!$C$200, 0))
And entered it as an array formula using ctrl shift enter.
However all I get is the contents of Data!A2 repeated over and over in every cell of my spreadsheet.
Does anyone need to know what I need to do to make this work?
This is my attempt at a local prototype following the example in BruceWayne's answer, the results are visible:
As you can see "Row 2" just appears repeatedly in the result column. Excel doesn't seem to have an easy way to see what version it is any more but this seems to be a pretty recent one, it's got the ribbon with the file menu and all menu headings are capitalized.
Here's a formula you can use (note: enter this as an array):
=IFERROR(INDEX(A$1:A$200,SMALL(IF(C$1:C$200="Fixed",ROW(A$1:A$200)-ROW(A$1)+1),ROWS(A$1:A1))),"")
You may need to tweak the ranges, I think I got them to match yours, but again, probably need to tweak. You can then drag this down, and it'll fill in with the values from column A, skipping any blanks.
Edit: Here's a screenshot to (hopefully) help show what I did:
You can edit the ranges, naturally, to be over two sheets.
To clarify, A$1:A$200 is the range of what you want to return (the index). C$1:C$200 is the range that holds "Fixed".

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