worksheet-function

Differences between string representations of date/times

為{幸葍}努か 提交于 2019-12-02 14:35:47
In Excel 2007, I want the differences for the following string date/times: A B C 1 Date1 Date2 Difference of A and B 2 2009.11.28 01:25:46:0287 2009.11.28 01:25:46:0287 ? 3 2009.11.28 01:25:46:0443 2009.11.28 01:25:46:0443 ? I want the differences by converting strings to date/time and then the results as differences of two converted date/times. A rather long-winded way to calculate zero (for the examples): =SUBSTITUTE(LEFT(A2,10),".","/")+MID(A2,12,8)+RIGHT(A2,4)/86400000-(SUBSTITUTE(LEFT(B2,10),".","/")+MID(B2,12,8)+RIGHT(B2,4)/86400000) By special request and very slightly shorter:

Formula to generate a value according to a range

吃可爱长大的小学妹 提交于 2019-12-02 14:01:32
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? 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,-1,"N"}) Negative values, zero, numbers less than 12 and positive or greater than 24, blanks and text would

Text encoding (converting to numeric) based on user-defined rules in Excel

给你一囗甜甜゛ 提交于 2019-12-02 11:53:06
I have data in text form that I need to encode/convert to numeric form according to rules I defined. To clarify: Need formula for output column so that it compares original text data with text-number encoding rules and returns numeric value of text in each row. Put this in C3 and drag down: =INDEX(F$2:F$6,MATCH(A3,E$2:E$6,0)) 来源: https://stackoverflow.com/questions/34124334/text-encoding-converting-to-numeric-based-on-user-defined-rules-in-excel

Comparing computed dates with entered dates

笑着哭i 提交于 2019-12-02 11:10:31
I have in cell p4 the date: 2014-01-01 (obtained via formula ( =(((O5/1000/60)/60)/24)+DATE(1970,1,1)) ) I have in cell b5 the date: 2014-01-01 (typed in) =(p4=b5) gives false =(p4>=b5) gives false How do I compare dates correctly in Excel? You should be safe with chopping the parts up and reassembling them: =DATE(YEAR(P4),MONTH(P4),DAY(P4))=DATE(YEAR(B5),MONTH(B5),DAY(B5)) Select the two date cells. Press CTRL+1 to show the format tab On the Number tab, in the Format list, click Text Perhaps there is a more appropriate comparison format, when you have dates in the format YYYY-MM-DD I think

Count paired instances where their elements are in different columns

不问归期 提交于 2019-12-02 08:27:18
My searches for answers have been limited by my lack of knowledge of the appropriate terminology. My goal is to count the number of times a specific username appears in one column AND the number 1 appears in another column for that user. I attempted to use COUNTIF, but it doesn't seem to format for that purpose. What I'm needing is to count the number of instances "username" appears in column K when "1" appears in column Q. If you have =COUNTIFS (you don't mention which version of Excel) please try, in Row1 and copied down to suit: =COUNTIFS(Q:Q,1,K:K,K1) there may be better ways (eg a

using indirect function in Excel

て烟熏妆下的殇ゞ 提交于 2019-12-02 08:15:45
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 in the former case (NVOL) somehow vanished. How do I make it sure it is visible so that the path can be

MATCH or VLOOKUP starting from the end of the range

假装没事ソ 提交于 2019-12-01 18:05:19
I have a table that looks like this A B ID1 data 123 ID2 data 234 ID1 data 456 ID2 data 567 I am trying to find the best way to retrieve data 567 for ID2. Using MATCH (with option 0) or VLOOKUP (with option FALSE) on ID2 gives me access to the first record but I want to retrieve the last record. I am using Excel 2010. ps: I'd rather not use VBA or manipulate the data (sorting...). lori_m With data in A1:B4 and D1="ID2", try entering in E1: =LOOKUP(2,1/(A1:A4=D1),B1:B4) Note: LOOKUP returns the last value if the lookup value is larger than any of the values in the lookup range. Any errors are

SumProduct over sets of cells (not contiguous)

自闭症网瘾萝莉.ら 提交于 2019-12-01 17:59:06
I have a total data set that is for 4 different groupings. One of the values is the average time, the other is count. For the Total I have to multiply these and then divide by the total of the count. Currently I use: =SUM(D32*D2,D94*D64,D156*D126,D218*D188)/SUM(D32,D94,D156,D218) I would rather use a SumProduct if I can to make it more readable. I tried to do: =SUMPRODUCT((D2,D64,D126,D188),(D32,D94,D156,D218))/SUM(D32,94,D156,D218) But as you can tell by my posting here, that did not work. Is there a way to do SumProduct like I want? It might be possible with masterful excel-fu, but even if

MATCH or VLOOKUP starting from the end of the range

故事扮演 提交于 2019-12-01 17:24:29
问题 I have a table that looks like this A B ID1 data 123 ID2 data 234 ID1 data 456 ID2 data 567 I am trying to find the best way to retrieve data 567 for ID2. Using MATCH (with option 0) or VLOOKUP (with option FALSE) on ID2 gives me access to the first record but I want to retrieve the last record. I am using Excel 2010. ps: I'd rather not use VBA or manipulate the data (sorting...). 回答1: With data in A1:B4 and D1="ID2", try entering in E1: =LOOKUP(2,1/(A1:A4=D1),B1:B4) Note: LOOKUP returns the

Sorting Worksheet data by column values using Excel VBA

浪尽此生 提交于 2019-12-01 16:19:14
I have next userform developed in vba, which takes info from a worksheet for displaying info I want to order all the info aphabetically by a Segment, this is the code: Function llenarDatosTabla() Dim vList As Variant Dim ws As Worksheet: Set ws = Worksheets(BD_PRODXSIST) ListBox1.Clear With ws If (IsEmpty(.Range("AA2").Value) = False) Then Dim ultimoRenglon As Long: ultimoRenglon = devolverUltimoRenglonDeColumna("A1", BD_PRODXSIST) vList = ws.Range("AA2:AA" & ultimoRenglon & ":AL2").Value If IsArray(vList) Then Me.ListBox1.List = vList Else Me.ListBox1.AddItem (vList) End If End If Me.ListBox1