Excel table column formula does not return desired result - excel

I have a "Report Deadline" column and "Date Report Issued" column on my table, and both are date-only columns with rows that can be blank. My goal is to add an additional column to the table that says "TRUE" only if the Report Deadline date has already passed AND there is not a date in the Date Report Issued column, it should show "FALSE" for any other scenario.
The formula I have created is shown below
=AND([#[Report Deadline]]<TODAY(),[#[Date Report Issued]]="",[#[Report Deadline]]>0)
But this formula seems to just display FALSE for all of the values, how can I correct it.

This worked for me (change the test for empty cell to isBlank()):
=AND([#[Report Deadline]]<TODAY(),ISBLANK([#[Date Report Issued]]),[#[Report Deadline]]>0)

Try this function. =if(and([column 1 reference]<Today(),not(isblank([column reference 2]))),true

Related

VBA min start date displaying a number

I have a column of dates in format dd/mm/yyyy and when I use the following code:
Sub DisplayDate()
MsgBox (WorksheetFunction.Min(Range("StartDate").EntireColumn))
End Sub
the result is 4442.7 which doesn't make sense as all entries in this column are either blank or in dd/mm/yyyy format. I'm trying to display the earliest date of the entire column. "StartDate" is the heading reference for that column, but this heading is in row 5 (there are four blank rows above it) It is working when the heading is not included i.e. taking from row 6 down, but I'm not sure how to code this using the name reference. I must use the name reference, not column number reference,
Using strings, VBA is confused and try guessing what you try extracting (as date). The returned value means "28/02/1912 16:48:00", but it is a wrong guess...
Sub DisplayDate()
MsgBox WorksheetFunction.Min(Range("StartDate").EntireColumn.Resize(Range("StartDate").rows.count - 1).Offset(1))
End Sub

Excel Table, using VBA to change data in a column

I have a Table with a column that I added, that checks the date of that row against a formula.
The result of that formulae is TRUE or FALSE and a subsequent Pivot Table Sums a value in the TRUE rows. I Introduced it to get what is called a Rolling Total Income.
There are two formula and I want to swap from one to another using VBA.
The formula are:
=IF([#Date] = "", "", AND([#Date]>=EOMONTH(TODAY(),-13)+1,[#Date]<EOMONTH(TODAY(),-1)))
for the Rolling data.
=IF(AND([#Date] >=G1,[#Date] <=H1),"TRUE","FALSE")
for the Sum of Income between G1 and H1, the financial year start and end dates.
The VBA I have tried is as follows:
Set lo = Sheet2.ListObjects(1) 'Sheet2 is the Income sheet see Project list
lo.Parent.Activate 'Activate sheet that Table is on
Set lColName = lo.ListColumns(9)
lColName.DataBodyRange.Cells(1).Formula = [=IF(AND([#Date] >=G1,[#Date] <=H1),"TRUE","FALSE")]
Running the above errors and gives #VALUE in the first cell in that column, and doesn't ripple through the rest of the column.
What have I done wrong?
Try
lColName.DataBodyRange.Formula = "=IF(AND([#Date] >=$G$1,[#Date] <=$H$1),""TRUE"",""FALSE"")"
Thanks, those changes have sorted it.
One more refinement I am struggling with.
The IF test statement is testing a date against cells, $G1 and $H1 which I set up for ease of debugging. However I have another worksheet in the workbook where I store all the references/static data I use in the various Sheets and I have placed those dates there. In this Module, before the IF statement, I have set those dates against two variables.
startdate = Range("I2").Value
enddate = Range("J2").Value
I now want to use those in the IF statement but cannot get the correct syntax!
This just errors:
"=IF(AND([#Date] >= startdate,[#Date] <= enddate),""TRUE"",""FALSE"")"
How should I write it?
Thanks

Format text column as a date unless there is specific text

I am new to Power Query.
I have a database, containing all text fields, to populate onto an excel spreadsheet as a requirement for business purposes. I am not allowed to add or delete tables in the spreadsheet. The problem I'm having is with the End Date column.
The End Date column can either have a date format or "TBD" as text if there is a start date but no end date.
Essentially I need power query to format the incoming in the End Date column as a date, unless the row contains "TBD". In that case I need the row to remain as "TBD". However as you can see from the picture above, it fails to populate correctly.
This is the formula I've been trying to get working but I haven't had any luck. Is there a way to accomplish this task?
= Table.TransformColumns(
_qryPerstat,{{"END DT",
each if qryPerstat[END DT] = "TBD" then "TBD" else Date.From(DateTimeZone.From()), type date}})

Report Validation by Row

Problem: Tasked with having users validate their reports. Users have to have their reports validated against a master report file. If their data exist within the report its valid.
Master Report Example:
User Report Example:
If the entire row of cell data exist then the row entry is valid, if not than not valid.
Task 2: If not valid row entry, identify which cells make the entry invalid.
Resolutions: Have attempted using countifs statements but did not result in away to identify which cell was making invalid, just if the entire row entry was valid.
Assuming "User Report" is Sheet2 & "Master Report" is Sheet1, with "PO" located in A1.
is Sheet2, cell E2 :
=IF(A2="","",IFERROR(MATCH(1,INDEX((A2=Sheet1!A:A)*(B2=Sheet1!C:C)*(C2=Sheet1!F:F)*(D2=Sheet1!G:G),0,1),0),"NOT OK"))
and drag downwards.
Idea : based on the same logic as the last formula here , iferror will output "NOT OK" if no match is found.
Please share if it work/understandable/not. ( :

How to report values matching Text field in row and date in column?

I need to match description fields in both sheet and return three of values
i.e. AVG, MIN & MAX value.
Please see below screenshots.
DATA SHEET AS VALUE SOURCE TO BE REPORTED IN MAIN SHEET
MAIN SHEET AS REPORT TO GET "AVG" VALUES FROM DATA SHEET BY MATCHING VALUES OF DESCRIPTION TEXT (e.g. $C16) & DATE (F$15)
"=VLOOKUP($C16,DATA!$A$3:$W$455,MATCH(F$15,DATA!$A$1:$W$1,0),FALSE)" is not working for my requirement and reports "N/A".
Paste in F16:
=VLOOKUP($C16,DATA!$A$3:$W$455,MATCH(F$15,DATA!$A$1:$W$1,0)+1)
This will only bring in the AVG. If you want all three values in the same cell:
=VLOOKUP($C16,DATA!$A$3:$W$455,MATCH(F$15,DATA!$A$1:$W$1,0)+1)&"/"&VLOOKUP($C16,DATA!$A$3:$W$455,MATCH(F$15,DATA!$A$1:$W$1,0)+2)&"/"&VLOOKUP($C16,DATA!$A$3:$W$455,MATCH(F$15,DATA!$A$1:$W$1,0)+3)
Copy and Paste accordingly

Resources