Date Function

excelesha

Board Regular
Joined
Apr 19, 2023
Messages
65
Office Version
  1. 365
Platform
  1. Windows
Hello, so i have a countifs formula, in there i am trying to find the accumulated amount from 2021 to a particular month in 2023, instead of having to change the 2023 month manually for each row, i want the 2023 month to be picked up from Col A instead, but i get an error if i replace "date(2023,8,31) with date(A1), see below formula in Col C:

=COUNTIFS(data44!$M:$M,"A",data44!$D:$D,">="&DATE(2021,1,1),data44!$D:$D,"<="&DATE(2023,8,31),data!$L:$L,"yes")



Col ACol BCol C
2023,8,31Aug
44​
2023,9,31Sept
67​
2023,10,31Oct
69​
2023,11,31Nov
89​
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
What exactly do you have in cell A1?
Is it a valid date?
Is is it a string?

2023,8,31 does not look like a valid date to me, unless you have applied a Custom format of something like yyyy,m,d to that cell.
 
Upvote 0
What exactly do you have in cell A1?
Is it a valid date?
Is is it a string?

2023,8,31 does not look like a valid date to me, unless you have applied a Custom format of something like yyyy,m,d to that cell.
I manually entered the month end date in A1, but the goal is to capture the count till month end of the indicated month in B1.
 
Upvote 0
if i replace "date(2023,8,31) with date(A1)
If the date you entered in A1 is already a valid date, just replace it with A1, and not Date(A1).

If you have the three letter month abbreviation in cell B1, and want to get the end of the month date for that month in the current year, you can use this formula:
Excel Formula:
=EOMONTH(DATEVALUE("1-" & B1 & YEAR(TODAY())),0)
 
Upvote 1
Solution
If the date you entered in A1 is already a valid date, just replace it with A1, and not Date(A1).

If you have the three letter month abbreviation in cell B1, and want to get the end of the month date for that month in the current year, you can use this formula:
Excel Formula:
=EOMONTH(DATEVALUE("1-" & B1 & YEAR(TODAY())),0)
the count is 0 if i reference to A1 directly......
 
Upvote 0
the count is 0 if i reference to A1 directly......
OK, so then what you entered into cell A1 is a string and not an actual valid date then.
If you want to use A1, can you enter an actual valid date instead of a string?

Or did you try my other suggestion?
 
Upvote 0
i changed the format of the call A1 to date, now it is working, thank you so much!
 
Upvote 0

Forum statistics

Threads
1,215,352
Messages
6,124,457
Members
449,161
Latest member
NHOJ

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top