worksheet-function

Using SUM() in VBA

寵の児 提交于 2019-12-01 03:11:06
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 = Application.WorksheetFunction.Sum("Sheet1:Sheet3!B2") End Sub I have two workarounds. I can the the sum

Using OR logic on an array as argument in Sumproduct

柔情痞子 提交于 2019-12-01 00:59:40
问题 I'm having a fairly large dataset where I need to combine multiple entries into a single value. My dataset contains data on the combination of two datasets, each using their own ID's and keys. I thought of using a Sumproduct() function like this: =SUMPRODUCT(--('Raw data'!C:C=Landgebruik!A2);--('Raw data'!O:O={20;21;22;23;40});'Raw data'!S:S) With Landgebruik!A2 holding an ID for the first dataset, which I need to aggregate the second dataset to. 'Raw data'!O:O contains the ID's from the

Conditional median in MS Excel

点点圈 提交于 2019-11-30 22:31:10
问题 I'm trying to calculate the conditional median of a chart that looks like this: A | B ------- x | 1 x | 1 x | 3 x | y | 4 z | 5 I'm using MS Excel 2007. I am aware of the AVERAGEIF() statement, but there is no equivalent for Median. The main trick is that there are rows with no data - such as the 4th "a" above. In this case, I don't want this row considered at all in the calculations. Googling has suggested the following, but Excel won't accept the formula format (maybe because it's 2007?)

How do I count consecutive same values

时光毁灭记忆、已成空白 提交于 2019-11-30 20:33:25
问题 I would like formulas that count the number of consecutive occurrences in a list of values and places the amount of times it occurs in the next columns. Here is a spreadsheet I created, it lists the results that Arsenal have achieved so far this season. The values in red are what I would like the formulas to achieve. https://dl.dropboxusercontent.com/u/92830254/test-sheet.xlsx I have 3 separate requests: 1) The current run of the team. So if Arsenal won 2 games in a row, then 2 would appear

Excel function to get first word from sentence in other cell

别来无恙 提交于 2019-11-30 11:37:02
Excel: What function can I use to take the all the characters from the beginning to the first '<". I am trying to strip out the first word from A1 and put it into B1 Eg: A1 Toronto<b> is nice I want "Toronto" in the next cell. Ian How about something like =LEFT(A1,SEARCH(" ",A1)-1) or =LEFT(A1,SEARCH("<b>",A1)-1) Have a look at MS Excel: Search Function and Excel 2007 LEFT Function Peter Walke If you want to cater to 1-word cell, use this... based upon astander's =IFERROR(LEFT(A1,SEARCH(" ",A1)-1),A1) Kamil K. Wawrzyszko I found this on exceljet.net and works for me: =LEFT(B4,FIND(" ",B4)-1)

How to find the first and second maximum number?

∥☆過路亽.° 提交于 2019-11-30 11:06:33
问题 I am trying to find first highest number and second highest number in excel. What shall i do for that. I did not find the right formula. Note: I have already used the large and max formula. =LARGE(E4:E9;1) edit: guys I know if i write 2 instead of 1 i will get the result but i have to click the mouse to see all result. 回答1: If you want the second highest number you can use =LARGE(E4:E9;2) although that doesn't account for duplicates so you could get the same result as the Max If you want the

Separating data and placing in individual worksheets Excel VBA [closed]

ぐ巨炮叔叔 提交于 2019-11-30 10:21:45
I have a large data set with over 80K entries of the following form: Name Date Value 1T17_4H19_3T19_3T21_2_a_2 09-Aug-11 -9.3159 1T17_4H19_3T19_3T21_2_a_2 10-Aug-11 -6.9662 1T17_4H19_3T19_3T21_2_a_2 11-Aug-11 -3.4886 1T17_4H19_3T19_3T21_2_a_2 12-Aug-11 -1.2357 1T17_4H19_3T19_3T21_2_a_2 15-Aug-11 0.1172 5 25_4Q27_4T30_4H34_3_3_3 19-Jun-12 -2.0805 5 25_4Q27_4T30_4H34_3_3_3 20-Jun-12 -1.9802 5 25_4Q27_4T30_4H34_3_3_3 21-Jun-12 -2.8344 5 25_4Q27_4T30_4Q32_a_a_a 25-Sep-07 -0.5779 5 25_4Q27_4T30_4Q32_a_a_a 26-Sep-07 -0.8214 5 25_4Q27_4T30_4Q32_a_a_a 27-Sep-07 -1.4061 This data is all contained in a

Have Excel formulas that return 0, make the result blank

a 夏天 提交于 2019-11-30 08:47:45
A recurring Excel problem I have is formulas such as INDEX(array,row,column) that return 0 when there's no result, rather than returning blank. What is the best way to change the zero result to blank? Here are approaches that I have tried so far: 1) Using division by zero. If INDEX returns 0, I cause an error that I then filter out. =IFERROR(1/1/INDEX(A,B,C),"") CONS: Makes the formula more messy and hides errors you may want to see. 2) Using custom formatting 0;-0;;@ CONS: 1) can't simultaneously apply date format 2) It doesn't work with conditional formatting when it comes to checking for

Case Function Equivalent in Excel

廉价感情. 提交于 2019-11-30 07:48:54
I have an interesting challenge - I need to run a check on the following data in Excel: | A - B - C - D | |------|------|------|------| | 36 | 0 | 0 | x | | 0 | 600 | 700 | x | |___________________________| You'll have to excuse my wonderfully bad ASCII art. So I need the D column (x) to run a check against the adjacent cells, then convert the values if necessary. Here's the criteria: If column B is greater than 0, everything works great and I can get coffee. If it doesn't meet that requirement, then I need to convert A1 according to a table - for example, 32 = 1420 and place into D .

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

别说谁变了你拦得住时间么 提交于 2019-11-30 00:14:24
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. Matt J 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 For a cell to self-reference itself: INDIRECT(ADDRESS(ROW(), COLUMN())) For a cell to self-reference its column: INDIRECT(ADDRESS(1,COLUMN()) & ":" & ADDRESS(65536, COLUMN())) For a cell to self-reference its row: INDIRECT