excel extract 6 digits from number, format as date and match with index match? - excel

I have the following 2 worksheets.
Data:
Column B Column C Column D COLUMN E Column F
329115121601 3291 5555 =Date (MID(B8,9,2),MID (B8,7,2),MID (B8,5,2)) 50 <---- Week Number from date
I am trying to extract 6 digits from my number value in Columb B '151216' and want to put this into column E. The 6 digits represent a date which is 15th December 2016.
I am using mid to try and get the number and then date to try and format this as 15/12/2016 - however it's not working. Instead I get 15/12/16.
On my other sheet, 'Home' i am trying to look up the number from column B on sheet 'Data' using an index match (array formula) where the values in column C, D and E or F match.
Home:
Column H Column I Column J Column K
3291 5555 15/12/2016 or Week 50 {=IFERROR(INDEX(Data!$B:$B,MATCH(1,(Home!$H10=Data!$C:$C)*(Home!$I10=Data!$D:$D)*(IF(Home!$J10<55,Home!$J10,WEEKNUM(Home!$J10))=Data!$F:$F),0)),"No Po Found")}
The user should be able to enter either week number or a specific date and get a result.
For some reason, this formula works if the user enters a week number, but not if they enter a specific date. I'm not sure if this is a format issue with the date on sheet 'data' or with the index match formula. Please can someone show me where I am going wrong? Thanks

Excel defaults to 1916 when I input your formula, try adding "20"& to the start of the year parameter:
=Date("20"&MID(B8,9,2),MID(B8,7,2),MID(B8,5,2))

I think you are doing it well. Just need to format the date.
Right click on the cell that contains the date ( 15/12/16 ) then click on cell formatting option and choose the format you prefer.

Related

FInd min Date in a date range with duplicate date

Using Excel and I'd like a formula that will return the earliest date from a row that contain duplicate date.
for example:
my row has 5 different dates, 1 duplicate and one blank cell
A B C D E F
09/01/2021 08/28/2021 09/08/2021 blank cell 09/01/2021 08/15/2021
I am using formula =MIN((A1:F1)
the return should be "8/28/2021" but I'm getting "1/1/1900"
can someone please help? that will be greatly appreciated
Try this:
=MIN(IFERROR(A1:F1*A1:F1/A1:F1,99999))
It will replace all the 0's with 99999 if it cannot be divided by itself (0).
(99999 is actually 10/13/2173 and was chosen at random as a date that will be later than the other dates on your list.)
You can do it with SMALL function:
SMALL function
My formula in column J is =SMALL(A1:G1;1)
Notice my date format is dd/mm/yyyy

How to assemble Offset function with Condition?

I Have date data in Column A and values data in Column B.
My aim goal is that for each date in column A :
look if one value (column B) during 1 year is less than 90% of the corresponding Value of the date.
This is my data:
Output example :
I start at the first date (31/12/1986) and see the 900.82 value.
I calcul 900.82 * 0.9 = 810.73
So i look if value in line 3 is inferior to 810.73,
If not
I look if value in line 4 is inferior to 810.73,
line 5, 6, 7 ,8..... during 1 year (that mean I stop this the 31/12/1987).
If it is
I stop and i look the next date (01/01/1987) and do the same.
I am agree to translate it in VBA code, but it could be better on Excel.
I first tried an algo to understand the problem :
-Look the first date in column A
-Look the corresponding value in Column B and save it as Value
-Offset to the next date in column A
-Look the corresponding value in Column B and save it as Range.to.compare
-If Range.to.compare < Value * 90% then write "ok" in Column C
-Else, Offset to the next date in column A...
-Untill 1 Year (Untill Year(Date in Column A)<Year(Date in Column A) +1
I try to translate it in Excel or VBA.
This this what I tried by Excel :
But it works only for 1 day instead of 1 year
I think this is what you're after. I broke the calculation into multiple columns to show the steps.
First I calculate the 90% value, in column C.
Column D is where most of the magic happens. In column D I find all rows that have a date < the current date + 1 year, and get the value (Col B) for each of those rows. I then take the minimum of all those values. Note this is an array formula so you need to press shift-ctrl-enter after you type it in.
Now that I have the minimum from the each range, I just need to compare that with the 90% value.

Index Match with multiple criteria not working properly?

I have 2 worksheets in an excel workbook.
Data
Column A Column B (PO) Column C (Supplier No) Column D (Item No) Column E(date) Column F (week no)
123406121601 - 555 =LEFT(A1,12) =LEFT(A1,3) =RIGHT(A1,3) 06/12/2016 =WEEKNUM(A1,21)
I have about about 1000 rows of data like the above.
In column A, each cell contains jumbled information consisting of a PO number and item number.
The PO number is the first 12 digits in the cell in column A, and the first 4 digits contain the supplier number.
The PO also is made up of a date, i.e. 123406121601 = a date of 061016 and once formated = 06/12/2016.
My formula's give the results below:
Column A Column B Column C Column D Column E Column F
ABC123409121601 - 555 123409121601 123 555 06/12/2016 49
On the second sheet, Home, i have the following:
Column A Column b Column C Column D Column E
123 555 06/12/2016 {INDEX MATCH FORMULA}
I am wanting to lookup the po number on sheet 2 where the supplier number, item number and date match - using the formula below:
=IF(C1<>"",INDEX(Data!B:B,MATCH(1,(Home!A1=Data!C:C)*(Home!B1=Data!D:D)*(Home!C1=Data!E:E),0)),INDEX(Data!B:B,MATCH(1,(Home!A1=Data!C:C)*(Home!B1=Data!D:D)*(D1=Data!F:F),0)))
Within this formula I have surrounded 2 index match formula's inside an if statement. This means the user can check for a result/PO Number based on the supplier number and item number and a specific date or the week number that date falls within.
For some reason, this index match works fine if im using static values and keeping my rows of data relatively short. However, for some reason, either by using formulas on sheet 'data' or by having more rows of data - this causes me to get the following result
NA!
Please can someone show me where i am going wrong?

how to get next non empty cell value in an excel column

Here is my excel looks
Column A Column B
1/1/2016
2/1/2016
3/1/2016
4/1/2016
5/1/2016
.
.
.
31/1/2016 1000
Now I will be referring one of the date in this month on another sheet and I would like to pull Column B value corresponding to last date on each month. There wont be any value till last date on column B.
Any hint to do this ?
First step is to make the condition:
=IF(A1=EOMONTH(A1,0),B1,"")
Note: if date in A1 is really the end of its month, it takes result from B1
Second step is to combine it with Vlookup. I assume that you would input some date in column C:
=IF(C1=EOMONTH(A1,0),VLOOKUP(C1,$A$1:$B$1000,2,FALSE),"")
Third step is... you can change the formula if your input is in another sheet. For the example: the data are in "sheet1" and the date input are in column C at "sheet2":
=IF(C1=EOMONTH(Sheet1!A1,0),VLOOKUP(C1,Sheet1!$A$1:$B$1000,2,FALSE),"")
Hope it'll help.

Excel If Statement finding number of days between two dates

As an example I have three columns Target completion, Actual completion and Entered date
Column A Target Completion 1/5/13/2013
Column B Actual Completion 1/25/2013
Column C Entered Date 1/2/2013
I need to add 30 days to Column A (Target Completion) and then compare that new date to Column B (Actual Completion) and finally show the result in days.
Like this;
Column A Target Completion 1/5/13/2013
Column B Actual Completion 1/25/2013
Column C Entered Date 1/2/2013
Result = -10 days (30 days are added to column A then minus column B)
Column A Target Completion 3/1/13/2013
Column B Actual Completion 5/1/2013
Column C Entered Date 1/2/2013
Result = 30 days (30 days are added to column A then minus column B)
I have been trying to get this if statement to work …but no luck!! Thank you in advance.
=if(E14="",DATEDIF(DATEVALUE("06/28/2013"),TODAY(),"d"),DATEDIF(E14,C14,"d"))
Try EDATE() function
=Edate(A1,1)-B1
Reference .. http://office.microsoft.com/en-001/excel-help/edate-function-HP010342465.aspx?CTT=5&origin=HP010342402
Excel stores dates as the number of days since Jan 1, 1900, so to get the number of days just subtract. So to add 30 days to column A then subtract column B, in row 1 that would be:
=A1 + 30 - B1
The if statement would seem to be trying to do something like
=IF(E14="",TODAY() - DATE(2013,6,13),C14-E14))

Resources