I am attempting to do something which sounds very simple, yet I couldn't find an answer anywhere online or here.
I am building an Excel database and have the main sheet with all the data I need, in which everything works great. I have many cells with text, and that text contains a hyperlink (in which I mean the URL is different than the text in the cell).
I have many other sheets which reference the main one. I have attempted to simply link the cells to their counterparts in the main (using a simple =location formula), but that only copies the text.
I then tried using =HYPERLINK(location), but that copies the text and creates a hyperlink, using the text as a URL instead of importing the URL I originally used.
What I want to do is link to another cell, displaying the text, but giving it the original URL I used in the main sheet.
EDIT: I want to be clear, that I can't use =HYPERLINK(location, name) because that still references the text in the original cell, NOT its hyperlink.
It could work if there would be a way to link a cell to the hyperlink in another cell, not the text in that cell.
Is such a thing possible at all without starting to use MACRO commands?
Not that it's a deal breaker, but I'd rather not get into it if I don't have to (since other people will work on it in the future, and they might not know anything about it).
A short User Defined Function (aka UDF) can strip the .Address property from the Hyperlink object.
Function what_url(rHL As Range)
If CBool(rHL.Cells(1).Hyperlinks.Count) Then
what_url = rHL.Hyperlinks(1).Address
Else
what_url = "not a hylerlink"
End If
End Function
There is also a .SubAddress property that can be appended to the .Address if required.
Related
I've been saving Google Sheets to Excel without any problems for a while. These sheets have always successfully saved and opened in Excel with the importrange function. However, recently it hasn't been successfully saving correctly.
It used to just have the static value (e.g, 40). There used to be an IFERROR in the first cell in the header row but now it exists in every single cell.
E.g, each cell would have something like this:
=IFERROR(__xludf.DUMMYFUNCTION(importrange(blahblah)),"40").
DUMMYFUNCTION throws an error and "40" is returned as a result. but "40" is a string, not an integer which messes up all my formulas.
I also know this isn't an Excel issue because OpenOffice is doing the same thing with the file.
I'm pretty sure this would be a bug because why would it be working for months and then suddenly stop working?
What should I do?
I'm thinking it's a bug too.
Workarounds
On Excel
Copy and paste as values only the ranges with IFERROR(__xludf.DUMMYFUNCTION(..., then use Excel's UI tools to convert numbers shown as text to numbers.
Selectively remove quotes on the IFERROR second argument of the cells causing problems
Remove =IFERROR(__xludf.DUMMYFUNCTION(),"value") except value (we could use Excel's built-in FIND & REPLACE for this)
On Google Sheets
Use Copy > Paste as values only on the range areas having formulas with non-compatible functions like IMPORTRANGE, QUERY, FILTER, etc.
If you only need the values, download it as CSV instead of XLSX
IMPORTANT
In order to help to prioritize this issue, send feedback to Google. To do this open a Google Sheets spreadsheet, click on Help > Report a problem, then fill the feedback form and submit it.
Related stuff
I posted 5 small articles about this in Spanish. You could find them listed on https://www.rubenrivera.mx/p/descargar-hcg-excel.html.
We accidentally created a workaround for this bug with a different sheet that was just set up like this.
This works when you IMPORTRANGE into another Google Sheet. We are doing it into a Google Sheet with a single worksheet - haven't tried it with multiple.
It's going to sound a little nuts but it works for us.
In the first cell of your import range put a hyperlink in the original document you are importing from. This is in the first cell of the import range. We linked it to a worksheet in the original document. It has worked and failed with an external link. With an external link it worked when I linked it to an internal link, then changed it. But when I deleted the cell and just straight linked it to an external URL it didn't work.
Then #timbo was right - put data validation in. This can be in part of the document that isn't being imported into the second sheet. I put it in the first line of the import range but outside what I was importing. It might have to be the first line. I just put a date in one cell, then in the next cell data > data validation > then choose that one date as the data range.
For aesthetics I have hidden the first row in one Google Sheet I am importing into. In another I made the first cell link the title of the sheet and put the data validation outside the import range. Both of these work.
Let me know if this works for you.
Until this bug is fixed, a workaround is to put a data validation (Data > Data Validation) on the imported data (Any kind of data validation will do).
I'm attempting to use an IF() function to conditionally make a cell a hyperlink.
=IF(LEFT(A1,4)="http",HYPERLINK(A1,"Link"),IF(A1="","",A1))
If the cell starts with HTTP, it will become a hyperlink.
If the cell contains nothing ("") it will show nothing.
If the cell contains another value, it will show that value.
Currently, no matter which scenario above is true, the resulting value displayed in the cell is clickable.
When the formula shows (eg) "Test", I can click that value and I get an error.
Is this a bug? Am I doing something wrong? I'm using Office Standard 2013.
Already answered here, I think? Summary: when Excel sees the Hyperlink function in the formula, it makes the cell followable, like a hyperlink. You can't prevent that, apparently, but you can give the else output a dummy destination like C:\ to avoid the error.
EDIT: Or better, a destination of "", which does nothing when clicked.
According to this site: http://www.excelforum.com/excel-formulas-and-functions/592520-can-i-create-a-formula-using-concatenate.html
there is a add in that can create formulas from strings called Morefunc.
If that works then you should be able to use the following:
=IF(LEFT(A1;4)="http";CONCATENATE("=HYPER"; "LINK")&"(A1;Link)";IF(A1="";"";A1))
It will return the formula as a string and probably the Morefunc add in can make it a formula.
But I'm not sure about that as I have never used it. There is also some other add in further down mentioned in the thread.
I have two workbooks:
WorkbookToUpdate.xls
Workbook_for_20130901.xls
In the first workbook I have the following:
A1 ='[Workbook_for_20130901]Sheet1'!$C5
Now a month goes by and I want to update the first work to reference Workbook_for_20131001.xls without going cell by cell and changing the name of the workbook. My thought was to make the date portion of the workbook name a variable and simply change that variable, but that doesn't seem to be working.
EDIT: I don't want to use Excel's INDIRECT function because I don't want to open the reference workbook.
I found one solution to be Harlan Grove’s PULL function (code can be found here), which works similarly to the INDIRECT function except that it doesn't require the source workbook to be open. The other solution, which actually works out to be faster than the Pull function (its only downfall) is the one I was using originally - Good ol' "find & replace". I thought that that was slow, but after trying the Pull function, it's not too bad.
Another option is by changing the source through excel's Data links, but this doesn't allow you to choose which cells keep the old source and which cells use the new one (in my case, I need the old values as well).
So here is what I want to do in VBA:
Find the value in E10, copy the row it is in, paste the row somewhere else (doesn't matter as long as I can find it) then finding the next row with the value E10 and doing the same thing, etc, until I reach the end of the spreadsheet
I'm really new to VBA and macros in general, so any help would be appreciated!
Generally speaking you'll find that asking questions without explaining "what have you tried" tends to be frowned upon in these parts.
I suggest that you take a look at this somewhat similar question that I answered just earlier today:
Copy & Paste row of data in Excel 2003 to different sheet by Email search
The principal differences between that one and your need are:
Instead of an InputBox, you'll use the value in E10 to run the .Find method; and
You need to create a loop. You still run the .Find method as shown in my example but you do it in a loop until you've looped through every instance of the value in E10 in the sheet. (Get the address of the first range that you find, and keep running the .Find method until you get back to that address.) Look up the While statement and the For statement in VBA help for examples on how to create a loop.
To get the value of an individual cell one way is just to create a reference to the cell range, then query the .Value property. For example a fully qualified reference could be:
Thisworkbook.Worksheets("Sheet1").Range("E10").value
There are other syntaxes which will yield the same result, but you can learn about those in time. Recording your actions using the Macro Recorder is a good way to learn about properties and methods. The problem is that in yet another part of the Excel 2010 interface that I detest, Microsoft has decided to hide the thing. To get to the Macro editor, go to File -> Options -> Customise Ribbon and turn on the Developer tab.
Give all of that a try and if you get stuck with something specific, post again with the details.
I am trying to create a hyperlink from one worksheet to another. The worksheet is large and there are many hyperlinks to places all over the other worksheet so I am trying to do this with a formula that I can copy/paste.
Here's what I have:
=HYPERLINK(CELL("address",INDEX('Test Results'!A:A,MATCH("TestCase-001",'Test Results'!A:A,0))),"TestCase-001")
The URI that it evaluates to is: '[Test Results 1.xls]Test Results'!$A$17, and A17 on the Test Results worksheet is indeed the correct cell to link to. The problem is when I click the hyperlink so I can just to test case details, I get an error saying "Cannot open the specified file", and I'm not sure why since the URI looks correct. Any ideas out there to help me fix this?
Using Excel 2003.
The CELL("address",... function returns in the format '[workbook]worksheet'!cell (as you say)
However, HYPERLINK expects [workbook]'worksheet'!cell (note the position of the ' marks) where worksheet name includes spaces.
Simplest answer would be to remove the spaces from the sheet names...
The CELL("address",... function returns in the format '[workbook]worksheet'!cell (as you say)
However, HYPERLINK expects [workbook]'worksheet'!cell (note the position of the ' marks) where worksheet name includes spaces.
Simplest answer would be to remove the spaces from the sheet names...
Figuring out why those two functions wouldn't work together was some great detective work!
Armed with that knowledge, I actually found a way to force the formatting from the response of the CELL function into the format that the HYPERLINK function expects/requires:
=HYPERLINK("[Workbook.xlsx]'Worksheet'!"&CELL("address", A10), "LinkLabel")
Without the full quotes, my version of office (2010) kept truncating the Workbook and Worksheet names because they were referring to the same sheet the code itself was being written in.