![]() |
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 |
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 |
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? |
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 |
All times are GMT +1. The time now is 02:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com