Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have an Excel spreadsheet which includes a column containing dates.
I am trying to create a formula which will tell me the number of cells in the column that have dates from last month. For some unknown reason I am having great difficulty with this - even before trying to ensure the formula will cope with the December/January issue, when the 'month-1' principle presumably will not work. Can anyone help please? Thanks, V |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
assuming your dates are in A1:A7 and todays date is in cell C1, try:
=SUMPRODUCT(--(TEXT(A1:A7,"mmyy")=TEXT(C1-DAY(C1),"mmyy"))) "Victor Delta" wrote: I have an Excel spreadsheet which includes a column containing dates. I am trying to create a formula which will tell me the number of cells in the column that have dates from last month. For some unknown reason I am having great difficulty with this - even before trying to ensure the formula will cope with the December/January issue, when the 'month-1' principle presumably will not work. Can anyone help please? Thanks, V |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
"JMB" wrote in message
... assuming your dates are in A1:A7 and todays date is in cell C1, try: =SUMPRODUCT(--(TEXT(A1:A7,"mmyy")=TEXT(C1-DAY(C1),"mmyy"))) JMB Many thanks. Works brilliantly! However, the only thing I don't understand is the two hyphens at the start of the first bracket? Regards, V |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
"Victor Delta" wrote in message ...
"JMB" wrote in message ... assuming your dates are in A1:A7 and todays date is in cell C1, try: =SUMPRODUCT(--(TEXT(A1:A7,"mmyy")=TEXT(C1-DAY(C1),"mmyy"))) JMB Many thanks. Works brilliantly! However, the only thing I don't understand is the two hyphens at the start of the first bracket? Two minus at the front convert text to numeric, such as making a number text value negative then positive. |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
"David McRitchie" wrote in message
... "Victor Delta" wrote in message ... "JMB" wrote in message ... assuming your dates are in A1:A7 and todays date is in cell C1, try: =SUMPRODUCT(--(TEXT(A1:A7,"mmyy")=TEXT(C1-DAY(C1),"mmyy"))) JMB Many thanks. Works brilliantly! However, the only thing I don't understand is the two hyphens at the start of the first bracket? Two minus at the front convert text to numeric, such as making a number text value negative then positive. Many thanks, V |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
David is correct, but the double minus also converts true/false values to 1
and 0 respectively. This allows you to sum the true/false values and get a count of how many trues there were. Bob Phillips has an excellent discussion on sumproduct here http://xldynamic.com/source/xld.SUMPRODUCT.html "Victor Delta" wrote: "JMB" wrote in message ... assuming your dates are in A1:A7 and todays date is in cell C1, try: =SUMPRODUCT(--(TEXT(A1:A7,"mmyy")=TEXT(C1-DAY(C1),"mmyy"))) JMB Many thanks. Works brilliantly! However, the only thing I don't understand is the two hyphens at the start of the first bracket? Regards, V |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
"JMB" wrote in message
... David is correct, but the double minus also converts true/false values to 1 and 0 respectively. This allows you to sum the true/false values and get a count of how many trues there were. Bob Phillips has an excellent discussion on sumproduct here http://xldynamic.com/source/xld.SUMPRODUCT.html Thanks for that. To be honest, I had not come across the Excel sumproduct function before. It looks very powerful so I will enjoy reading this interesting article. V |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
divide a month's target into weeks | Excel Discussion (Misc queries) | |||
Finding this month's cell | Excel Worksheet Functions | |||
PivotTable contains last month's dates | Excel Discussion (Misc queries) | |||
Finding the most recent month's (or whatever) data | Excel Discussion (Misc queries) | |||
Pull Current Month's Data Out of List - Repost | Excel Discussion (Misc queries) |