I am currently using this formula: =SUMPRODUCT(1*(YEAR(E2:E81)=2018)) However i want to run this formula on a summary tab and the data will be on another sheet called "BRIDGE". I tried =SUMPRODUCT(BRIDGE!1*(YEAR(E2:E81)=2018)) but I get an error
Rather than putting the sheet reference as you have, put it prior to the range instead.
=SUMPRODUCT(1*(YEAR(BRIDGE!E2:E81)=2018))
Related
I am using Spreadsheet::WriteExcel. I want to merge two cells and give the hyperlink to the content inside merged cells.
I have tried like this.
$Log_Sheet->merge_range('D2:E2','Home',$MergedFormat);
$Log_Sheet->write_url('D2','internal:sheet1!A1');
This is working fine but when I try to open a file it shows a warning saying File error: data may have been lost. This occurs because D2 cell is being overwritten.
How can I merge cells and give hyperlink in one call?
I can't promise this works on Spreadsheet::WriteExcel, but it does on Excel::Writer::XLSX. I'd encourage you to try it on Spreadsheet::WriteExcel.
With merged ranges, once you declare a format, you need to continue using it for that range and never use it for non-merged ranges. So, if you take your code and add the tag and the format object:
$Log_Sheet->merge_range("D2:E2", 'Home', $MergedFormat);
$Log_Sheet->write_url('D2', 'internal:sheet1!A1', 'Click Me!', $MergedFormat);
It does appear to work... on Excel::Writer::XLSX. Sorry to keep referencing that.
Alternatively, per the previous post (File Error:data may have been lost while giving hyperlinks), you can also use the built-in Hyperlink function within Excel:
my $merged = $workbook->add_format();
$worksheet->merge_range("A10:A11",
qq{=hyperlink("#'Sheet3'!A1","Click Here!")},
$merged);
I have vlookups to pull specific data from a workbook and paste into a new workbook in the desired layout. The layout of the first workbook never changes however the name will change when i want to run this on a different file.
My current formula is =VLOOKUP(A3,[Workbook1.xlsx]Sheet1!$B$3:$XFD$7,2,FALSE)
I would really like it to reference A1 instead of Workbook1 so I could then just update the file name in A1 every time I want to analyse a different file. I should mention the Sheet name won't ever change.
I know you have to use INDIRECT but im unsure how it works. I did try =VLOOKUP(A3,INDIRECT(A1),$B$3:$XFD$7,2,FALSE) but then i'd too many arguments and when i removed the $B$3:$XFD$7 i lost the range i was searching in.
Thanks!
With INDIRECT you must create the whole string that denotes the range reference:
=VLOOKUP(A3,INDIRECT("'[" & A1 & "]Sheet1'!$B$3:$XFD$7"),2,FALSE)
One more note, that INDIRECT requires that the workbook be open to function, or will return an error.
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).
I have 3 workbooks - Parent1.xlsx and Child.xlsx
Parent1.xlsx has data that will be referenced by Child.xlsx through vlookup.
The vlookup formula is
=VLOOKUP(1,[Parent1.xlsx]Sheet1!$A$1:$B$7,2,FALSE)
That works fine.
Now I have to make a copy of Parent1.xlsx to Parent2.xlsx.
In order for Child.xlsx to work I have to change the formula to
=VLOOKUP(1,[Parent2.xlsx]Sheet1!$A$1:$B$7,2,FALSE)
That is ok if its just for 1 cell, but I need to do it for many cells.
To fix this, I plan to used a named range for the file name. So in Sheet2 of Child.xlsx, I have a named range "parent" that has the name of the file - Parent2.xlsx.
I can't seem to get that to work.
If the value for the named range "parent" is
'[Parent2.xlsx]Sheet1'
then I'm trying to get
=VLOOKUP(1,parent!$A$1:$B$7,2,FALSE)
to work.
Is this even possible? Other than copy pasted everything and using VBA, is there another possibility?
Thanks
If you just need to change all the external references to the file Parent2, rather than Parent1, choose the Data tab, Edit Links and click Change Source.
Try:
"=VLOOKUP(1," & ActiveWorkbook.Names("parent").Value & "!$A$1:$B$7,2,FALSE)"
Edit: just realized this is the VBA solution. This won't work in a cell formula.
Here's what I want to do...
I have an excel with a bunch of sheets... let's name them A,B,C,D.
And another one where I get values from one of them depending what the user enters in one cell.
So... to get a value from a sheet I use the following formula
='[file.xls]A'!$I$15
What I want to do... is if an user enters value B in a specific cell to have the formula changed to:
='[file.xls]B'!$I$15
Is there any way to do this?
Thanks!
You can only INDIRECTly reference a workbook that is open. If you are not going to open the external reference document, then you will need to install additional functionality into your Excel.
The ADD-IN is called MoreFunc...read all about it here:
http://xcell05.free.fr/morefunc/english/
Download and install it from here:
http://download.cnet.com/Morefunc/30...-10423159.html
Go into TOOLS > ADDINS and activate MoreFunc.
Now you have many, many new functions available to you. Any place you used INDIRECT, now use INDIRECT.EXT instead and it will work on closed workbooks.
Build the address string, and then use INDIRECT to retrieve its value.
e.g: if the sheet sheet name is in A1, then your formula could be something like
=INDIRECT("'[file.xls]" & A1 & "'!$I$15")