I have a table as under
AAA 28/01/2016
I tried many option like changing format. Datevalue, Datevalue(text...) functions but the date is not being converted into number.
You got AAA 28/01/2016 in either one cell or two and want to make that text into an actual date or even a number.
The formulas in C1:C2 are,
=DATE(RIGHT(B1, 4), MID(B1, 8, 2), MID(B1, 5, 2)) ◄ C1
=DATE(RIGHT(B2, 4), MID(B2, 4, 2), MID(B2, 1, 2)) ◄ C2
Format however you want after you have made the text-to-date conversion. To avoid ambiguity, the above uses dd-mmm-yyyy_) . A true number would be 0 to show 42,397. Note that text (by default) is left-aligned in the cell while dates and numbers are right-aligned.
Use below function.
=TEXT(A1,0)
Simply put:
=--A1
Then format the cell as you want. The -- will change it to a number.
Related
I'm trying to build a MATCH formula (or a similar one) that returns the position of the first value (date) within a range that matches a specific year.
For example, if I have a list of dates, like this:
A
1 12-31-2014
2 11-30-2015
3 12-29-2016
4 12-30-2017
For the value 2016, it should return 3.
MATCH(2016,A:A,0) doesn't work, since it's not an exact match. I can't use any aux columns either nor modify the dates.
Any ideas?
Are you allowed to use array formulas? If so, it may be as simple as this:
=IFERROR(MATCH(2016,YEAR($A$1:$A$4),0),"No Match")
Remember to commit the answer using Ctrl+Shift+Enter, since it'll be an array.
You'll want to change the references within the YEAR function to match your range. By using 0 as your [match_type] parameter, you're going to get the first value in the list that has a year of 2016.
For real dates, try,
=aggregate(15, 6, row($1:$999)/(year(a$1:a$999)=2016), 1)
'return the date with index as,
=index(a:a, aggregate(15, 6, row($1:$999)/(year(a$1:a$999)=2016), 1))
If they are in ascending order you could use,
=MATCH(42369, A:A)+1
=index(a:a, MATCH(42369, A:A)+1)
For a list of strings that look like dates try,
=MATCH("*2016", A:A, 0)
=index(a:a, MATCH("*2016", A:A, 0))
I want to use the value of a cell which is a logical operator (>,≥,<,≤) in a formula to calculate another cell.
For example an IF statement based on a logical operator:
A1: 5
A2: 3
A3: >
A4: 4
A5: =IF((A1-A2) ??A3?? A4;1;0)
By what do I need to replace ??A3?? to make this work?
The only way I can think to do this would be to encode formulas for each type of comparsion operator. For example, if you wanted to support both < and > in the following formula:
IF((A1-A2) OP A4, 1, 0)
then you could include formulas for both less than and greater than, and choose one based on A3:
IF(A3="<", IF((A1-A2) < A4, 1, 0), IF(A3=">", IF((A1-A2) > A4, 1, 0), -1))
In the formula immediately above I return -1 should A3 contain an operator which we did not expect (not < or > in this simple example).
You can use something like the formula below:
=NOT(ISERROR(FIND(A3, MID("<≤≥>", 2 + SIGN((A1-A2) - A4), 2))))
So, generally speaking, your formula will be the following:
=NOT(ISERROR(FIND(#OPERATOR#, MID("<≤≥>", 2 + SIGN(#OP1# - #OP2#), 2))))
The benefit is that you need to specify the numbers that you're comparing only once (so can you can have any arbitrary long formula for these numbers, without worrying that you're duplicating it).
This works by mapping the symbols <, ≤, ≥ and > to the numbers 1, 2, 3, 4 and then comparing this against the sign of the difference of the initial numbers.
I need to return a cell that has text in it, but am running into difficulty.
Above is a sample table I'm working with. What I'd like to be able to do, is lookup id 1 and have it output Rich. When I do a vlookup, however, it gives no output. And while vlookup min/max will output integers, they don't work with text. Does anyone know how I can scan multiple ids, but only output the filled text cell?
There may be a shorter formula for this but I banged this off quickly and it does dynamically truncate the ranges in column B down to the minimum number of rows necessary.
=INDEX(B:B, AGGREGATE(15, 6, ROW(B2:INDEX(B:B, MATCH("zzz",B:B )))/(ISTEXT(B2:INDEX(B:B, MATCH("zzz",B:B )))*(A2:INDEX(A:A, MATCH("zzz",B:B )))=D3), 1))
To retrieve a second, third, etc. entry change the k parameter of AGGREGATE to a COUNTIF and fill down.
=INDEX(B:B, AGGREGATE(15, 6, ROW(B$2:INDEX(B:B, MATCH("zzz",B:B )))/(ISTEXT(B$2:INDEX(B:B, MATCH("zzz",B:B )))*(A$2:INDEX(A:A, MATCH("zzz",B:B )))=D3), COUNTIF(D$3:D3, D3)))
I have a column of dates that are in the format: yyyymmdd.
An example is shown below:
19480110
19480111
19480115
19480119
19480124
19480130
19480131
19480201
19480204
19480209
19480210
19481225
19481226
19490212
19491210
19500108
19500208
I would like to be able to identify ONLY the cells that have 3 OR MORE consecutive dates. In this case, the cells with the following values would be highlighted:
19480130
19480131
19480201
Currently, I have a formula of the form:
=IF(A2=A1+1, "Match", "")
However, it fails to recognize instances when there is a change in the month, as in the case of this example: It only prints match next to the cell that has '19480131' in it. Is there a way to account for changes in months with the present formatting?
Thank you!
You need to convert the date text to a date value, e.g.
=IF(DATE(VALUE(LEFT(A2,4)),VALUE(MID(A2,5,2)),VALUE(RIGHT(A2,2)))=DATE(VALUE(LEFT(A1,4)),VALUE(MID(A1,5,2)),VALUE(RIGHT(A1,2)))+1, "Match", "")
With data in column A starting at A2, in B2 enter:
=DATE(LEFT(A2,4),MID(A2,5,2),RIGHT(A2,2))
and copy down. This converts to real dates. then in C2 enter:
=B2-B1
and copy down
If there are two consecutive 1's in column C, we have a consecutive triplet (at least). So in D2 enter:
=IF(OR(AND(C2=1,C3=1), AND(C2=1,C1=1), AND(C4=1,C3=1)),"*","")
How about =IF(A2=A1+1, "Match", IF(AND(OR(MOD(A1, 100) = 31, MOD(A1, 100) = 30, MOD(A1, 100) = 29, MOD(A1, 100) = 28), MOD(A2, 100) = 1), "Match", ""))
Having said that, there is a caveat that if you have Jan 28 and then Feb 01 it will say that is consecutive where you know it is not. If you want something that doesn't have that issue, I can code that.
I have 2 Excel files and I'm trying to compare two numbers (one has 7 digits and the second 5 digits).
For example in an excel file I have the following number 1234567 and in another file I have 12345 in one cell in another cell I have the remaining digits 67. I want to compare the first number with the second and if they are the same i need to identify the cells that have the value 67 and to print what is in the next cell.
They are constantly changing so I'm having problems getting this right
I made this formula but it doesn't work properly. Did I miss something?
=IFERROR(IF(INT(RIGHT(A5;2))=VLOOKUP(INT(LEFT(A5;5));'Path[file.xls]
Sheet1'!$S$3:$AA$200;2;FALSE);VLOOKUP(INT(LEFT(A5;5));'path[file.xls]
Sheet1'!$S$3:$AA$200;3;FALSE);VLOOKUP(INT(LEFT(A5;5));'path[file.xls]
Sheet1'!$S$3:$AA$200;5;FALSE));"")
From your description and sample formula, I pieced together some sample data in File.xls.
Note by the right alignment, these are true numbers. This is important. A VLOOKUP or MATCH function will not find RIGHT(A2, 5) amongst numbers; it has to be --RIGHT(A2, 5). With 7 digit numbers in another workbook, I used this standard formula.
=INDEX([File.xls]Sheet1!$S:$AA, MATCH(--LEFT(A2, 5), [File.xls]Sheet1!$S:$S, 0), MATCH(--RIGHT(A2, 2), INDEX([File.xls]Sheet1!$S:$AA, MATCH(--LEFT(A2, 5), [File.xls]Sheet1!$S:$S, 0), ), 0)+1)
Note that every values is expected to be found. If this is not the case, then an IFERROR function should be used to handle non-matches.
The results were as follows.