Excel -- Comparing dates in different formats - excel

I'm trying to run a formula that essentially compares two different date columns to determine if another formula needs to be run but I'm running into trouble because the dates are in different formats. For example, I have column A with dates in DD-MMM-YY format and column B where the dates are in QYY format.
DATE INCOME_QTR STATUS
22-Feb-05 1Q18
13-Oct-17 1Q18
29-Apr-08 1Q18
03-Oct-16 1Q18
05-Apr-19 1Q18
02-Mar-15 1Q18
Essentially I want to do an IF statement to determine if the date in column A is greater than or equal to the quarter to determine if the data tied to the first date should be incorporated into the Quarter shown in column B. In simpler terms, only row 6 would be "yes" in this case because the date in column A is greater than the Quarter in column B.
I've been trying to run =IF(TEXT([#[date]],"YYYYMMDD">TEXT([#[income_qtr]],"YYYYMMDD")),"YES","No") but I haven't been successful.
Ideally I'd like to be able to do this without adding any modules or using VBA.
Thanks for your help!

=IF(RIGHT(A1,2)>RIGHT(B1,2),"Yes",IF(RIGHT(A1,2)<RIGHT(B1,2),"No",IF(IF(OR(MID(A1,4,3)="Jan",MID(A1,4,3)="Feb",MID(A1,4,3)="Mar"),1,IF(OR(MID(A1,4,3)="Apr",MID(A1,4,3)="May",MID(A1,4,3)="Jun"),2,IF(OR(MID(A1,4,3)="Jul",MID(A1,4,3)="Aug",MID(A1,4,3)="Sep"),3,4)))>=RIGHT(B1,1),"Yes","No")))
That's the formula for A1 and B1...

Related

Count How Many License Registered in the specific month

How to formula using CountIf function in Excel to get the count of licenses registered in January given the Register date is complete date format. Below is the sample structure of Excel data. As shown in the table below, there are 3 licenses registered in the month of January.
You can add a new column for the month, which I'll call B, and put the following function in the first cell of that column, and then copy it down:
=Month(B1:B4)
Then where you want the count to appear (I used C5), use the following formula:
=CountIf(B1:B5, 1)
This displays the following results:
This correctly performs the count regardless of the date format for the cell, as long as it's a date. In other words, it works for mm/dd/yyyy, d/m/yyyy, dd/mm/yyyy, and yyyy/mm/dd equally as well, which removes the issue of trying to parse out the first two characters of a string.
I tried various methods but i had to unfortunately use helper column to extract month number from dates. I used left function to extract month number as Left(B2,2). Then i used countif function to count all cells have "01" countif(C2:C6,"01"). This is not the best solution but it worked.

Using COUNTIFS with different date formats

I am trying to calculate the totals of a column when the date column is within a certain month. The value to find is in a different date format to the format in the criteria range and I can't figure out how create a formula using the two different date formats. Here are the columns where I am trying to get the totals from:
Here is where I am trying to count the rows when it falls within a certain month and year:
This is the formula I have created but this doesn't work and just returns 0:
=COUNTIFS($A$3:$A$27, YEAR(G3), $A$3:$A$27, MONTH(G3))
I have also tried this but it is still returning 0:
=COUNTIFS($A$3:$A$27, "=YEAR(G3)", $A$3:$A$27, "=MONTH(G3)")
Format is irrelevant if your dates are REAL dates
If your dates are "real" dates, merely formatted a certain way
And if your Months are also real dates where the date is actually the first of the month,
Then:
=COUNTIFS(Dates,">="&B15,Dates,"<=" &EOMONTH(B15,0))
Where Dates is the Named Range containing your list of dates, and B15 contains your month/year formatted first of the month date.
If your months column is not the first of the month, then a minor change is all that is needed to convert the first criteria to the first of the month:
=COUNTIFS(Dates,">="&DATE(YEAR(B15),MONTH(B15),1),Dates,"<=" &EOMONTH(B15,0))

How to sum data in a column corresponding to a start date to today's date

So, I am working on a loan payoff sheet and I wanted my excel sheet to be automatically updating.
One of my questions was answered when I searched how to select data corresponding to today's date using the function VLOOKUP(TODAY(),A:B,2,0) but that will only respond data in the column adjacent to today's date.
I would like to sum the data in the column of daily interest from the start date (provided) and have it automatically update for today's date. Attached is a snapshot of what I am trying to describe.
I currently have the dates stretched out several months in the future and am just summing the entire column of daily interest values.
If anyone knows how I can choose a start date of the first day and then automatically sum the values of the dates in between that would be fantastic.
Assuming Column A is your Date column and its the only numbers in the column you can use:
=MIN(A:A)
Having said that normally charts like this are built by a start date provided in a cell somewhere. If you can find that cell, simply link to it instead.
In order to get your sum of only appropriate dates, you will want to look at the formula SUMIFS. This will allow you to have multiple criteria that all have to be true. Assuming your interest is in column C you might be able to use the following formula:
=SUMIFS(C:C,A:A,">="&MIN(A:A),A:A,"<="&TODAY())
'Substitute your direct cell link for MIN(A:A) if you have it
Basically
=SUMIFS(Range to sum, range to check 1, criteria for check 1, range to check 2, criteria for check 2)
If for some reason you have data above and below your dates and interest column, you may need to adjust your ranges from A:A to A5:A678 where 5 is the first row of your data and 678 is the last row of your data.
With dates in column A and value in column B, place the start date in C1 and the formula:
=TODAY()
in C2. Then in another cell enter:
=SUMPRODUCT(--(A1:A9999<C2)*(A1:A9999>C1)*B1:B9999)
This formula give the sum of values between the date limits (not including).
The formula does not require the dates in column A to be in sorted order.

Excel using COUNTIFS Function to create a Punchcard

In my data source I have a column that contains the Dates of occurrences and a Column that contains the Hour of the same occurrences.
With this, the goal is to obtain a punchcard plot (maybe the bubble chart will be the most appropriate)
The intermediate structure has the weekday(Sunday-Saturday) as rows (A2:A8), and the hours (8-22) as Columns (B1:P1), as each column must have the occurrence count for a week day in an hour.
With this said, I tried to use the COUNTIFS function, using the following approach, for the cell B2:
=COUNTIFS(WEEKDAY(RawData!T2:T9852;1);A2;HOUR(RawData!U2:U9852);B1)
However, Excel is not computing the value, finding a problem on the formula, having also tried using the Insert Formula Option.
place the following in B2
=SUMPRODUCT((WEEKDAY($T$2:$T$8,1)=WEEKDAY($A2,1))*(HOUR($U$2:$U$8)=HOUR(B$1)))
you will need to convert the , to match the ; on your system
In your range A2:A8 enter a known date for monday such as 2017/08/20. Then select A2:A8 and apply custom formatting for the number format and set it to ddd. This will display the day of the week in text but keep the value in the cell a number.
Adjust the ranges to suit your data.
Copy the formula to fill in your table.

Formula creation - date comparison

I'm trying to construct an Excel formula which compares the date in column A to the date in column B and tells me YES if they are the same date, tells me NO if they are different dates, then if NO tells me what is the oldest of the two dates.
What I have is not working:
=IF(A1=B1,"YES","NO"&(A1,B1))
=IF(A1=B1,"YES","NO "&TEXT(MIN(A1,B1),"mm/dd/yyyy"))
Or if you just want the oldest date without the "NO" then do this (be sure to format cell as date):
=IF(A1=B1,"YES",MIN(A1,B1))

Resources