worksheet-function

Excel Select Case?

南楼画角 提交于 2019-11-27 01:42:35
问题 i want to create the "cases" formula for excel to simulate Select case behavior (with multiple arguments and else optional). If A1 and A2 are excel cells, this is the goal: A1 Case: A2 Formula: A2 Result 5 cases({A1>5,"greather than 5"}, {A1<5, "less than 5"},{else,"equal to 5"}) equal to 5 Hi cases({A1="","there is nothing"},{else,A1}) Hi 1024 cases({5<A1<=10,10},{11<=A1<100,100},{A1>100,1000}) 1000 12 cases({A1=1 to 9, "digit"}, {A1=11|22|33|44|55|66|77|88|99, "11 multiple"}) (empty) 60

Extract the last substring from a cell

断了今生、忘了曾经 提交于 2019-11-27 01:18:59
I have names in a column. I need to split just the last names from that column into another column. The last name is delimited by a space from the right side. The contents in cell A2 = Alistair Stevens and I entered the formula in cell B2 (I need 'Stevens' in cell B2 ) I tried using the following formulas: =RIGHT(A2,FIND(" ",A2,1)-1) =RIGHT(A2,FIND(" ",A2)) Both these formulas work for this cell but when I fill it down / copy and paste it for the cells below it doesn't work. I get the wrong values!! A3 -> David Mckenzie B3 -> Mckenzie Jean-François Corbett This works, even when there are

XIRR Calculation

ε祈祈猫儿з 提交于 2019-11-27 00:17:54
问题 How do I calculate Excel's XIRR function using C#? 回答1: According to XIRR function openoffice documentation (formula is same as in excel) you need to solve for XIRR variable in the following f(xirr) equation: You can calculate xirr value by: calculating derivative of above function -> f '(xirr) after having f(xirr) and f'(xirr) you can solve for xirr value by using iterative Newton's method - famous formula-> EDIT I've got a bit of time so, here it is - complete C# code for XIRR calculation:

Get values from other sheet using VBA

纵饮孤独 提交于 2019-11-26 23:01:54
问题 I want to get values from other sheets. I have some values in Excel (sheet2) for example: A B C D - - - - 1 | 2 5 9 12 2 | 5 8 4 5 3 | 3 1 2 6 I sum each column in row 4. I'm working with these values in sheet2 but I want to get the result in sheet1. When using my code in sheet2 I get the correct answer but when I try to use it in a different sheet I get the result of the values corresponding to the current sheet cells and not to sheet2. I'm using With Application.WorksheetFunction . How can

How to Round in MS Access, VBA

ぃ、小莉子 提交于 2019-11-26 22:58:58
Whats the best way to round in VBA Access? My current method utilizes the Excel method Excel.WorksheetFunction.Round(... But I am looking for a means that does not rely on Excel. Be careful, the VBA Round function uses Banker's rounding, where it rounds .5 to an even number, like so: Round (12.55, 1) would return 12.6 (rounds up) Round (12.65, 1) would return 12.6 (rounds down) Round (12.75, 1) would return 12.8 (rounds up) Whereas the Excel Worksheet Function Round, always rounds .5 up. I've done some tests and it looks like .5 up rounding (symmetric rounding) is also used by cell formatting,

Get the last non-empty cell in a column in Google Sheets

浪尽此生 提交于 2019-11-26 17:59:01
问题 I use the following function =DAYS360(A2, A35) to calculate the difference between two dates in my column. However, the column is ever expanding and I currently have to manually change 'A35' as I update my spreadsheet. Is there a way (in Google Sheets) to find the last non-empty cell in this column and then dynamically set that parameter in the above function? 回答1: There may be a more eloquent way, but this is the way I came up with: The function to find the last populated cell in a column is

How to extract text within a string of text

淺唱寂寞╮ 提交于 2019-11-26 16:34:51
问题 I have a simple problem that I'm hoping to resolve without using VBA but if that's the only way it can be solved, so be it. I have a file with multiple rows (all one column). Each row has data that looks something like this: 1 7.82E-13 >gi|297848936|ref|XP_00| 4-hydroxide gi|297338191|gb|23343|randomrandom 2 5.09E-09 >gi|168010496|ref|xp_00| 2-pyruvate etc... What I want is some way to extract the string of numbers that begin with "gi|" and end with a "|". For some rows this might mean as

Get parent folder path from file path using cell formula

依然范特西╮ 提交于 2019-11-26 14:37:59
问题 In column A I have 20000 rows with filename with file path "C:\person\microsoft\ygkyg\mmddyy\filename.xls" "\server-41\performance\mmddyy\filename.doc" ..... etc. In column B I just want to get the parent folder path. Could someone help me with the formula? I tried this but it's giving me the file name. =MID(a1,FIND(CHAR(1), SUBSTITUTE(a1,"\",CHAR(1),LEN(a1)-LEN(SUBSTITUTE(a1,"\",""))))+1,LEN(a1)) 回答1: This works. =MID(A1,1,LEN(A1)-LEN(MID(A1,FIND(CHAR(1),SUBSTITUTE(A1,"\",CHAR(1),LEN(A1)-LEN

Excel formula to get cell color

a 夏天 提交于 2019-11-26 12:16:12
问题 I would like to know if we can find out the Color of the CELL with the help of any inline formula (without using any macros) I\'m using Home User Office package 2010. 回答1: No, you can only get to the interior color of a cell by using a Macro. I am afraid. It's really easy to do (cell.interior.color) so unless you have a requirement that restricts you from using VBA, I say go for it. 回答2: As commented, just in case the link I posted there broke, try this: Add a Name(any valid name) in Excel's

How do I slice an array in Excel VBA?

无人久伴 提交于 2019-11-26 11:45:20
What function can I use in Excel VBA to slice an array? Lance Roberts Application.WorksheetFunction.Index(array, row, column) If you specify a zero value for row or column, then you'll get the entire column or row that is specified. Example: Application.WorksheetFunction.Index(array, 0, 3) This will give you the entire 3rd column. If you specify both row and column as non-zero, then you'll get only the specific element. There is no easy way to get a smaller slice than a complete row or column. Limitation : There is a limit to the array size that WorksheetFunction.Index can handle if you're