Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Number of records for last 7 days
Hello,
You guys have been very helpful to me in the past. I have a spreadsheet with a column of dates, I would like a textbox on a form display the number of records in the last x days. I can probably handle some of this but not sure how to get a variable to return the value. Any help appreciated. Regards, Rick |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Number of records for last 7 days
Hi,
Am Sat, 16 Jul 2016 19:47:18 -0000 (UTC) schrieb R D S: I have a spreadsheet with a column of dates, I would like a textbox on a form display the number of records in the last x days. your dates in Sheet1 column A: Private Sub UserForm_Initialize() Dim x As Long, days As Long, period As Long x = 12 period = Date - x days = Application.CountIf(Sheets("Sheet1").Range("A:A"), "=" & period) TextBox1.Text = days End Sub Regards Claus B. -- Windows10 Office 2016 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Number of records for last 7 days
On Sat, 16 Jul 2016 22:14:53 +0200, Claus Busch wrote:
Hi, Am Sat, 16 Jul 2016 19:47:18 -0000 (UTC) schrieb R D S: I have a spreadsheet with a column of dates, I would like a textbox on a form display the number of records in the last x days. your dates in Sheet1 column A: Private Sub UserForm_Initialize() Dim x As Long, days As Long, period As Long x = 12 period = Date - x days = Application.CountIf(Sheets("Sheet1").Range("A:A"), "=" & period) TextBox1.Text = days End Sub Regards Claus B. That's fantastic thanks. Now how about similar to return month so far? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Number of records for last 7 days
On Sat, 16 Jul 2016 20:53:24 +0000, R D S wrote:
On Sat, 16 Jul 2016 22:14:53 +0200, Claus Busch wrote: Hi, Am Sat, 16 Jul 2016 19:47:18 -0000 (UTC) schrieb R D S: I have a spreadsheet with a column of dates, I would like a textbox on a form display the number of records in the last x days. your dates in Sheet1 column A: Private Sub UserForm_Initialize() Dim x As Long, days As Long, period As Long x = 12 period = Date - x days = Application.CountIf(Sheets("Sheet1").Range("A:A"), "=" & period) TextBox1.Text = days End Sub Regards Claus B. That's fantastic thanks. Now how about similar to return month so far? As we put records on the spreadsheet AA3 has the date of the last one entered, so this seems to have sorted it. monthsofarperiod = Date - (Left(Range("AA3"), 2)) monthday = Application.CountIf(Range("AA3:AA1000"), "=" & monthsofarperiod) txtMonthSoFar.Text = monthday |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find number of weekdays and wekend days given a total number of da | Excel Discussion (Misc queries) | |||
Formula Returning Records # of Days from Today in Excel | Excel Worksheet Functions | |||
Count Number of Records and Number of Fields in CSV File | Excel Programming | |||
how do i convert a number of days to years, months & days? | Excel Discussion (Misc queries) | |||
A number of days into weeks and days | Excel Worksheet Functions |