Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find number of weekdays and wekend days given a total number of da Juan Correa Excel Discussion (Misc queries) 7 February 19th 10 09:47 PM
Formula Returning Records # of Days from Today in Excel Pettitte46 Excel Worksheet Functions 2 July 20th 08 08:54 PM
Count Number of Records and Number of Fields in CSV File ExcelMonkey Excel Programming 0 November 29th 07 10:58 PM
how do i convert a number of days to years, months & days? SafetyLen Excel Discussion (Misc queries) 1 August 23rd 07 01:34 AM
A number of days into weeks and days Robert Christie Excel Worksheet Functions 4 August 31st 05 03:23 AM


All times are GMT +1. The time now is 03:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"