Compare two columns as date - vba

I have two columns in excel like column send out date & column received date. I want to compare each "Send Out Date & Received Date", if the difference is longer than 3 working day exclude Sunday then turn the "received date cells" will RED color.
[Send Out Date] [Received Date]
26-May 28-May
26-May **29-May**

In excel 2010:
select the range you want to format (e.g. B2:B3 in your example)
in home tab select conditional formatting - new rule - use a formula to determine which cells to format.
type this: =NETWORKDAYS.INTL(A2,B2,11)>3
click format and set the formatting you need.

Related

Identify Week Number, Month Number, Year from DatePicker control in VBA userform

I have been trying to make my user form work by getting codes everywhere. I don't have any experience in VBA so the code that I have are patches from different sources.
I have a datepicker control in my user form and i'd like to get the corresponding week number, month number and year based on the date that is chosen from the datepicker control box and populate the corresponding textboxes for each
datepicker and textbox dependencies.
To get the week number use the below. The third and fourth arguments allow you to dictate the first day/first week of the year.
TextBoxWeek.Value = DatePart("ww", TextBoxDatePicker.Value, vbMonday, vbFirstJan1 )
Month:
TextBoxMonth.Value = format(TextBoxDatePicker.value,"mm")
Year: (you can also use "yy" to get the shorthand date eg. '17' rather than '2017')
TextBoxYear.Value = format(TextBoxDatePicker.value, "yyyy")

Excel Formula or VBA to convert year, month data to actual date

I have 2 columns (year and month). A sample data of year column A is 2015 at cell A2. A sample data of month column B is Jun at cell B2. I would like to convert these data to date format in column C to '2015-06-00` at cell C2. Is there a formula or Excel VBA to do this?
First off, 2015-06-00 is actually 31-May-2015. If you supply zero as the day-of-the-month, you get the last day of the previous month. Typically you would set it for the first day of the month. Use the DATE function for this with 1 as the day_num parameter or the DATEVALUE function if you are stringing together text-that-looks-like-a-date.
=datevalue(B2 & " 1, " & A2)
With a three letter month in B2, you will have to translate that to a numerical month if you opt for the DATE function.
=DATE(A2, LOOKUP(B2, {"Apr","Aug","Dec","Feb","Jan","Jul","Jun","Mar","May","Nov","Oct","Sep"}, {4,8,12,2,1,7,6,3,5,11,10,9}), 1)
in cell C "=FECHA(A2;B2;1)" (spanish excell)

Excel Macro to separate date into year month week

I am having a really difficult time with this excel table and was trying to use VBA as well as Excel functions to get the date formatted into Year, Month, Week but I keep running into issues.
I have the below input:
The reason Column1 looks so odd is because I was TRYING to use =MONTH([Date]) but it looks all weird and doesn't sort into the month or week it is supposed to.
Below is the expected outcome if everything were to work.
So using the Date column I want to generate 3 columns: Year, Month, Week
Any idea if I am doing something wrong in excel or if there is an easy way to do this in VBA?
with the date in A2 , in E2 enter:
=A2 and format as "yyyy"
In F2 enter:
=A2 and format as "mm-mmmm"
In G2 enter:
="Week " & ROUNDUP(DAY(A2)/7,0)
Not sure where the issue is but the following formulae will give you year, month, and day. Where a1 contains a date
=year(a1)
=month(a1)
=day(a1)
Of course if you want the month to show the month in words rather than a number you can format the cell as custom and then mmm
You are using the right formula the only thing amiss is your column formatting as it is correctly pointed out in the comments. Follow these steps to get the desired formatting
Select the column and right click Click 'Format Cell'
In the'Number' tab select 'Custom' in the category list
Enter 'mm - mmmm' as the type.
You should get '12 - December'
Formula for year: =YEAR([#Date])
Formula for month: =MONTH([#Date]) & "-" & TEXT([#Date],"mmmm")
Formula for week: ="Week " & WEEKNUM([#Date],2)-WEEKNUM(EOMONTH([#Date],-1)+1,2)+1
and use appropriate format for each column.

Format date in Values for a Range (Gant) Chart SSRS 2008 R2

I have a date column in which the dates are re-curring every year. I'm only interested in the month really, but I can't just put the month number as the high and low value for the gant chart. Is there any way I can format the column? Any suggestions would be awesome.
The gant chart currently is taking the whole date and is working fine, but like I said it goes out to the next year.
Figured it out. So the DATECOLUMN I had was formated as such:
Example: 2013-01-01 00:00:0.000
In order to put in the GANT(RANGE) CHART in the series property, under values, I formated the Top Value and Low Value as =MONTH(DATECOLUMN) using the expression option.
Then for the Horizontal Axis Properties I set the Interval to 1 and Interval Type to Number. And There you have it Monthly time spans with only the Months 1 - 12 showing.
I must also note that I only had one time recorded. So I just did Top Value as: DATEADD(MM,1,DATECOLUMN) In Order to get the right time span in my dataset Script.
Which date format would u like to display in your chart.
If (month with year) like 'Sep 2013'
use this date format for the same.
SUBSTRING(CONVERT(VARCHAR(11),getutcdate(), 113),4,8)

QlikView Problems with Listbox

I want to have a list box that shows the following:
YYYY: WeekNumber - Date
The Date part is using a Broadcast Calendar (starts on Sundays, so week 1 of 2012 is actually Monday 12/26/2011).
This needs to be conditional:
If the year selected is the current year, only show through the latest "broadcastMonday" which in this case is Week 9 (2/20/2012). Then go back all the way through the prior year to week 1 of 2011, which is actually 12/27/2010.
If the year selected is less than the current year, only show all of that year plus all of the prior year.
The following expression for the List Box is working just fine for me with respect to displaying the right information, but when I click an item in the list it doesn't select it:
=If([Year]=year(ReloadTime()),if(left(BroadcastPeriod2,4)>=[Prior Year]
and BroadcastWeekStart2<ReloadTime(),(left(BroadcastPeriod2,4) & ' : ' &
BroadCastWeek2 & '-' & date(BroadcastWeekStart2)),),if(left(BroadcastPeriod2,4)>=
[Prior Year] and left(BroadcastPeriod2,4)<=([Year]),left(BroadcastPeriod2,4) & ' : '
& BroadCastWeek2 & '-' & date(BroadcastWeekStart2),))
I think the answer is to either do it in the load (concatenating the fields) or to use a table instead of the input box.
I would try to calculate the value for the listbox in the loadscript. I had trouble comparing StartMonth values in set analysis and could come around this by pre-calculating the values at load time.
Did something similar in Qlikview aggration with conditions