I have an issue with excel and would need an solution preferably without having to use VBA code.
My excel document has two sheets:
Rawdata sheet: contains data; column A has content in timestamp format (dd-mm-yyyy hh:mm:ss)
Calculations sheet: uses countif() and sumif() formulas
Now I have a set of date parameters in my calculation sheet, also formatted with the timestamp format as seen above. I now want to use those parameters in my formulas as conditions, for example:
countif(Rawdata!A:A;">=Parameter1";Rawdata!A:A;"<Parameter2")
Although I have data that fits those parameters only 0 is displayed.
Is there any problem with the syntax of the formular itself or is the issue caused by errors concerning the formatting of the date parameters/ data??
if Parameter1 and Parameter2 are named ranges you need to separate the content form the literal String
countif(Rawdata!A:A;">=" & Parameter1;Rawdata!A:A;"<" & Parameter2)
Related
I have a combination of two reports into a master file. I'll be eventually transforming the data into a more readable format, but I have a date column that has two different types of date formats:
(yyyy-mm-dd & mm/dd/yyyy)
Is there a formula I can use to convert this so every cell reads: mm/dd/yyyy?
I know I can do it via text-to-columns, but that will take a bit longer than I'd like.
I will repost the question if it only can be done via VBA, but I figure there may be a way to just complete it via one formula and an auto fill.
You can probably just use:
=DATEVALUE(A1)
And copy it down. You can then format the date to whatever format you like.
DateValue() Takes a date stored as a string and converts to excel's date type.
I was wondering if there was a way to use the CDate function in a countif statement? I'm trying to find dates less than 2 weeks old, am and currently using this statement:
=COUNTIF(CDATE(Table1[Date Closed]),">=" &TODAY() - 14)
I need to turn the Date Closed of the table into actual dates without changing the table (right now they're in the format 13-Mar-2018 but as text format).
Is there a way to do this within the Countif function or am I going to have to do a a VBA code to first change the dates?
Thank you!
=SUMPRODUCT(--(DATEVALUE(Table1[TextDates])>=(TODAY()-14)))
Although I do wonder why you can't have dates as real Excel dates, rather than text strings
Set up your table and insert a column (you could hide the original or place the new column at the end or next to the original) and convert the text date to a date via the DATEVALUE() function.
See reference:
https://support.office.com/en-us/article/datevalue-function-df8b07d4-7761-4a93-bc33-b7471bbff252
You may want to apply format to the new cell/column to look like a date.
Set up your table for "Using structured references with Excel tables."
See reference:
https://support.office.com/en-us/article/using-structured-references-with-excel-tables-f5ed2452-2337-4f71-bed3-c8ae6d2b276e
Count dates based on your condition.
See reference:
https://support.office.com/en-us/article/count-numbers-or-dates-based-on-a-condition-976d0074-245d-49e6-bf5f-1207983f82ed
I'm trying to use the countif function to count how many employees complete training late. The required by date and all the completion dates are recorded on a separate workbook.
I know the usual forumula is =countif(range, criteria) and have no issues when I type an actual required by date for the criteria. The issue has to do with referencing a cell in a seperate workbook. The formula looks like this: =countif(xxxxG37:G158,>xxxxG5) with xxxx being the location of the external workbook.
The formula works just fine when I put an actual date (i.e >xxxxG5 = 11/6/17).
The issue has to deal with how I"m referencing the criteria cell.
Any help would be appreciated. Thanks! The data looks as follows:
G5 11/6/17
G37 11/2/17
G38 11/3/17
G39 11/9/17
G40 11/10/17
G41 11/1/17
G5 is the required by date. G37-G41 are the completion dates. I want to count how many of the dates are after 11/6/17.
Here is a typical syntax:
=COUNTIF([b.xlsx]Sheet1!$G$37:$G$41,">" & [b.xlsx]Sheet1!$G$35)
where the formula appears in another workbook (a.xlsx)
I have cells in my excel sheet that contain a date.
The display format for these cells is a custom format "mmmmm-yy"
so that the date "7/1/16" appears as "S-16". This works format works on the excel sheet, however, in VBA I try to call the Format() function on these cells, it does not yield the same format.
Format( <Date_Cell> , "mmmmm-yy")
Gives
"April4-16"
on the chart, for example.
Why does the Format function not behave the same as formatting a date cell?
Edit: According to the office support website, Format a date the way you want, I am using the correct format, but it is not producing the result the website claims it should.
Edit2: Turns out cell date formatting works differently than the VBA Format function, as the selected answer points out.
The meaning of the format symbols of the VBA function Format and the Excel Date Format are not 100% identically.
You could use the worksheet function TEXT like:
Application.Text( <Date_Cell> , "mmmmm-yy")
to achieve what you want.
The VBA Format function doesn't support the "mmmmm" format as first letter of the month (see the documentation for supported formats). Your output is actually parsing as "mmmm" (month name), then "m" (month number). If you only need the first letter of the month, you'll need to parse it out manually:
Left$(MonthName(Month(<Date_Cell>)), 1) & "-" & Right$(CStr(Year(<Date_Cell>)), 2)
One more option:
Change the number format of the cell:
Range("A1").NumberFormat = "mmmmm-yy"
I am creating a metadata sheet for about 300 or so records. The two columns I am most concerned with getting perfectly matched are DATE (e.g., yyyy-mm-dd format per ISO 8601) and filename (e.g., asdf_v05_i03_yyyy-mm-dd.pdf). I want to make sure that the DATE column's data matches the FILENAME column's date string. I have tried a few different excel functions to return a TRUE or FALSE value in a different column to do the fact-checking for me, but nothing I've tried seems to work. I suspect it may have something to do with how Excel formats dates.
Any suggestions for how I should format my formula?
Example Data (Tab delimited):
Date Filename
1996-01-05 asdf_v17_i01_1996-01-05.pdf
1996-01-12 asdf_v17_i02_1996-01-12.pdf
1996-01-19 asdf_v17_i03_1996-01-19.pdf
1996-01-26 asdf_v17_i04_1996-01-26.pdf
1996-02-02 asdf_v17_i05_1996-02-02.pdf
if the naming is always the same on the pdf then you could use the following:
=A2=--MID(B2,14,10)