excel-2007

How to optimize opening and closing excel workbooks to extract data to run faster

做~自己de王妃 提交于 2019-12-30 06:56:08
问题 I currently know of two methods to open and close excel workbooks to extract data from them to summarize in a single workbook. The first method is as follows: Dim wbDataSheet As Workbook For FNum = LBound(MyFiles) To UBound(MyFiles) Set wbDataSheet = Workbooks.Open(MyPath & MyFiles(FNum), 0, True) 'Capture data wbDataSheet.Close (False) Next FNum The second is this: Dim XL As New Excel.Application For FNum = LBound(MyFiles) To UBound(MyFiles) With XL .Workbooks.Open FileName:=MyPath & MyFiles

Always show two decimal points in excel cells using Apache poi

非 Y 不嫁゛ 提交于 2019-12-30 06:00:15
问题 For example, XSSFCellStyle style=(XSSFCellStyle) workbook.createCellStyle(); style.setDataFormat(workbook.createDataFormat().getFormat("#.##")); productCell.setCellValue(12.4); productCell.setCellType(Cell.CELL_TYPE_NUMERIC); productCell.setCellStyle(style); This displays 12.4 in the specified cell. It should be 12.40 . The value 12 is displayed as 12. which is quite unnecessary. If the value is 0 then, it displays a dot . . It should always display two decimal digits - 0.00 , in this case

How to export data from Matlab to excel for a loop?

一曲冷凌霜 提交于 2019-12-30 05:29:13
问题 I have a code for "for loop" for i=1:4 statement... y=sim(net, I); end now i need to export the value of y to excel sheet. for that i used.. xlswrite('output_data.xls', y, 'output_data', 'A1') but my problem is that the ID of excel i.e. "A1" should change according to each iteration... in my case for iteration 1-> A1, iteration-> A2 and so on.. anybody please help me out .. thanks in advance. for any assistance.. or suggestion.. 回答1: You can store sim outputs in a vector ( y(ii) ) and save in

Find the number of a row that contains two specific values?

痞子三分冷 提交于 2019-12-29 08:51:45
问题 I have a table of information with multiple columns. The first column is "Date" (range A:A) and the second column is "Name" (range B:B). When I enter a date into cell Q1 and a name into cell R1, I need a formula that will find which row contains both of those values and output the row number. I feel like I need to use the match function but can't quite figure it out. Does anyone know how to do this? 回答1: You can use MATCH in an "array formula" like this =MATCH(1,(A:A=Q1)*(B:B=R1),0) which

When called from an Excel VBA UDF, Range.Precedents returns the range and not its precedents. Is there a workaround?

与世无争的帅哥 提交于 2019-12-29 08:32:35
问题 I have this VBA function: Public Function testPrec(target As Range) As String testPrec = target.Precedents.Address(External:=False) End Function In cell C11, I have this formula: =C6+C8 If I call testPrec from the immediate window, it works just fine: ?testPrec([c11]) $C$6,$C$8 EDIT: It also works fine if called from a non-UDF macro Sub. The anomaly is the UDF case. If I call it from the worksheet as a UDF: =testPrec(C11) I just get back "$C$11". Does anyone know what's going on, or even

Excel Array formula IF(multiple criteria)

青春壹個敷衍的年華 提交于 2019-12-29 06:32:53
问题 In my spreadsheet, comparing headphones, our instruction is basically to use as many different formulas as possible. So as part of the spreadsheet, I would like to be able to show the most expensive headphones per manufacturer , cheapest per manufacturer, best rated per manufacturer etc... So far I have been able to get some mostly working array formulas. For example, this formula works to get the model of the manufacturer "Sennheiser" with the highest price: =INDEX($Data.$B$5:$L$32,SMALL(IF(

Converting HTML to Excel? [closed]

a 夏天 提交于 2019-12-29 03:28:29
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 10 months ago . I know that Excel is capable of opening HTML files directly. But the content of the file will still be HTML. Is there any way I can change the contents of the file from HTML to XLS or XLSX? 回答1: So long as Excel can open the file, the functionality to change the format of the

Round function in Excel, worksheet function vs VBA

◇◆丶佛笑我妖孽 提交于 2019-12-29 01:42:08
问题 I had an application for returning closest matches to certain values in a large cluster of values( as in my earlier question) and I chose a VBA solution. While in the course of using the said application, I observed that the results for the value of 0.5 were not correct. I had been using the VBA Round function which I found to be returning 0 for 0.5 rounded to integer whereas the worksheet round function returns 1. Strangely, the VBA round function returns 2 for 1.5. I had to substitute the

Import Dynamic and Static ranges from Excel in to MS-Access that do not start at cell A1

半世苍凉 提交于 2019-12-29 01:38:09
问题 How might I link a data range from an Excel spreadsheet so that the data in that range appears as a useable table in Access? Linking to an Excel sheet that has data starting at cell A1 is easy enough, but where data in the Excel spreadsheet starts elsewhere in the sheet, I'm not sure how to get Access to pin-point it, especially if that non-A1 range is dynamic. Access doesn't seem to pick up named/dynamic ranges when going through the import/link wizard. Real world scenario: I have an Excel

C# external library (Lua) call problem

我怕爱的太早我们不能终老 提交于 2019-12-29 01:01:27
问题 I'm new to programming in C# (VS2010) .Net (4.0) and I'm encountering I couldn't solve by myself since some days already. I'm using an external scripting language (Lua) in my C# code. To do so I use LuaInterpreter built for .Net 4.0 First try: The project is a console application -> the program works fine when I try to call a Lua class. Second try: The project is a class Librrary COM used from Excel -> The class library compile fine and my user defined functions work fine within Excel. But