worksheet-function

Count all rows in column A containing “(CLOSED)” or “(DO NOT USE)”

烈酒焚心 提交于 2019-12-04 02:15:24
问题 I am trying to return by Excel function a count of all the rows in column A where the text (CLOSED) or (DO NOT USE) is contained. All rows will contain other values too like so: Row 1 = Nice Day (CLOSED) Row 2 = Hello (CLOSED) Row 3 = Cats & DOGS (CLOSED) Row 4 = Cats (DO NOT USE) so I need to search for the keywords (closed) or (do not use) in amongst the text. Here's what I've tried to do so far but it doesn't work: =COUNTIF(Sheet2!A2:A3187,"(CLOSED)") Please can someone point me into the

Using SUM() in VBA

安稳与你 提交于 2019-12-04 00:26:01
问题 If I have a set of cells in a worksheet that I want to add up, I can use the formula: =SUM(Sheet1!A1:A10) To do this in a sub, I would use: Sub example1() Dim r As Range, v As Variant Set r = Sheets("Sheet1").Range("A1:A10") v = Application.WorksheetFunction.Sum(r) End Sub If, however, I want to add up a single cell across many worksheets, I use the formula: =SUM(Sheet1:Sheet38!B2) In VBA this line fails miserably, as explained in Specify an Excel range across sheets in VBA: Sub dural() v =

No max(x,y) function in Access

会有一股神秘感。 提交于 2019-12-04 00:22:24
VBA for Access lacks a simple Max(x,y) function to find the mathematical maximum of two or more values. I'm accustomed to having such a function already in the base API coming from other languages such as perl/php/ruby/python etc. I know it can be done: IIf(x > y, x,y) . Are there any other solutions available? I'll interpret the question to read: How does one implement a function in Access that returns the Max/Min of an array of numbers? Here's the code I use (named "iMax" by analogy with IIf, i.e., "Immediate If"/"Immediate Max"): Public Function iMax(ParamArray p()) As Variant ' Idea from

Check the number of unique cells in a range

微笑、不失礼 提交于 2019-12-03 21:24:23
I have an excel sheet. Under column E, I have 425 cells with data. I want to check if the same data (i.e. text inside the cell) is repeated anywhere else in any of the remaining 424 cells under column E. How do I do this? For example, in E54 I have Hello Jack How would I check this value to see if it was in any other of these cells? You could use =SUMPRODUCT(1/COUNTIF(E1:E425,E1:E425)) to count the number of unique cells in E1:425 An answer of 425 means all the values are unique. An answer of 421 means 4 values are duplicates of other value(s) Use Conditional Formatting on all the cells that

Self-reference for cell, column and row in worksheet functions

南楼画角 提交于 2019-12-03 18:40:28
问题 In a worksheet function in Excel, how do you self-reference the cell, column or row you're in? Note that this is extremely useful for conditional formatting. 回答1: where F13 is the cell you need to reference: =CELL("Row",F13) yields 13; its row number =CELL("Col",F13) yields 6; its column number; =SUBSTITUTE(ADDRESS(1,COLUMN(F13)*1,4),"1","") yields F; its column letter 回答2: For a cell to self-reference itself: INDIRECT(ADDRESS(ROW(), COLUMN())) For a cell to self-reference its column:

How to create a new worksheet in Excel file c#?

限于喜欢 提交于 2019-12-03 12:48:39
I need to create a very big Excel file, but excel file in one worksheet can contain up to 65k rows. So, i want to divide all my info into several worksheets dynamical. This is my approximate code //------------------Create Excel App-------------------- Excel.Application xlApp; Excel.Workbook xlWorkBook; Excel.Worksheet xlWorkSheet; object misValue = System.Reflection.Missing.Value; xlApp = new Excel.Application(); xlWorkBook = xlApp.Workbooks.Add(misValue); xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(numberOfLetters); foreach (string letter in letters) { xlWorkSheet.Cells

How do you extract a subarray from an array in a worksheet function?

≡放荡痞女 提交于 2019-12-03 12:39:46
Is there some way of getting an array in Excel of a smaller size than a starting array in a cell worksheet function? So if I had: {23, "", 34, 46, "", "16"} I'd end up with: {23, 34, 46, 16} which I could then manipulate with some other function. Conclusion: If I was to do a lot of these I would definitely use jtolle's UDF comb solution. The formula that PPC uses is close, but diving in and testing, I found it gives errors in the empty slots, misses the first value, and there is an easier way to get the row numbers, so here is my final solution: =IFERROR(INDEX($A$1:$A$6, SMALL(IF(($A$1:$A$6<>"

How to remove ALL numbers from a cell with a function or regex?

北城以北 提交于 2019-12-03 09:32:13
I have cells that look like this, one per line: Duffy,John: 'Heritage: Civilization and the Jews'- Fanfare & Chorale,Symphonic Dances + Orchestral Suite. Bernstein,'On the Town' Dance Episodes. Royal Phil./R.Williams Lilien,Ignace 1897-1963: Songs,1920-1935. Anja van Wijk,mezzo & Frans van Ruth,piano Hindemith,Trauermusik. Purcell,'Fairy Queen' Suite. Rossini,String Sonata 6. Petrov,'Creation of the World' Ballet Suite. Bartok,Romanian Folkdances Sz 56. Tartini,Flute Concerto in G w.A.Maiorov Leningrad Orch.for Ancient & Modern Music/ Serov Bizet,Verdi,Massenet,Puccini: Arias from Carmen

Formula to generate a value according to a range

99封情书 提交于 2019-12-02 23:18:52
问题 I want to populate a cell according to the range of another cell. Like if the independent cell has the value between 12 to 16 then the dependent cell will be populated as -2 and if the independent cell has a value between 16 to 20 then -1 and if 20 - 24 then N and so on: Sample Is there any formula or how otherwise can I do it? 回答1: Assuming 16 is "between" 16-20 rather than "between" 12-16 and that for N it is the text of the OP that counts rather than the image: =LOOKUP(A1,{12,16,20,24},{-2

using indirect function in Excel

◇◆丶佛笑我妖孽 提交于 2019-12-02 17:02:16
问题 I am using indirect function to create a link into another closed workbook. The objective is to retrieve the values without opening the workbook. I have used the following in one place which works. =INDIRECT("[NVOL.xlsb]Sheet1!A"&C6) However, in another place in the same sheet, the following does not work (gives a #ref error) =INDIRECT("[MTM.xlsb]Sorted!A"&B6) It appears [NVOL.xlsb] is taken as a substitute for the full path but the full path is not visible. I have two questions a) The path