I have a range of cells M4:M18. In that range of cells is a formula referencing another table, there will only be one date in this range of cells. I'm trying to get that one date to populate into cell H12. This is the formula that I have in H12:
=IF(COUNTA(M4:M18)=1,INDEX(M4:M18,MATCH("*",M4:M18,0)),"")
I've also tried:
=IF(COUNTIF(M4:M18,"?")=1,INDEX(M4:M18,MATCH("?",M4:M18,0)),"")
This formula returns a black cell in H12. I read a previous post regarding this same issue, but I can't seem to get it to work. The first cell in this range could be empty.
Any help would be greatly appreciated.
Thanks
M4:M18 ='Step 2 Triage_Tbl';$Q3 and are formatted as m/d/yy;;""
In VBE (ALT+F11) insert a module into your worksheet and copy the code into it.
In Excel in cell H12
type =OneDate(M4:M18)
. You might need to format H12
as Date if not already formatted.
Option Explicit
Function OneDate(CheckRange As Range) As Date
Dim rng As Range
For Each rng In CheckRange
If IsDate(rng.Value) Then OneDate = rng.Value: Exit For
Next
End Function
You might need to adjust the Macro settings for this to work:
File > Options > Trust Center > Trust Center Settings > Macro Settings
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.