Formula Date Format/Input Error?

pure vito

Board Regular
Joined
Oct 7, 2021
Messages
183
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I have been struggling keep this formula working as intended, I've spent a lot of time scratching my head over this,

The Issue is with column D and the date if I manually type the date it works fine, if I use a formula in i.e. =Now() it sometimes works 🤷‍♂️

Now I wish to input the date via a user form a textbox this I have completed and the date from the textbox is pasted to D2:D100 but for some reason the formula will not work
because of this date input, I have include a copy of the data unfortunately L2BB does not work with my work computer,

I really can't work this out, can anyone assist please, Thanks in advance.

=IFERROR(IF(INDEX('Data Sheet'!$C$9:$ND$59,MATCH(C2,'Data Sheet'!$B$9:$B$100,0),MATCH(D2,'Data Sheet'!$C$9:$ND$9,0))= "","Yes",""),"")

MrExcel.xlsx

1674803903639.png
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
2 things.
• Your first match runs to row 100 but the Index range only runs to 59
• Your date column D is formatted as Date but the values are actually entered as Text.
How is your data getting in to that sheet ?
You can convert it selecting column D, then Text to Columns > Delimited > Finish
But you will still need to address how you are getting the data so you don't have to do that each time.
 
Upvote 0
Thank you Alex for your assistance, great advise :giggle:

Here is the VBA I am using to input the date, the worksheet is ("Available")

Again thanks Alex,

VBA Code:
Private Sub showall_Click()
' ---------- Show All ---------------

Dim sh As Worksheet
Set sh = Sheets("JobRequirements")
Dim iRow As Long
iRow = sh.Range("A" & sh.Rows.Count).End(xlUp).Row
Roledate.Value = Format(Roledate.Value, "dd/mm/yyyy")
Worksheets("Available").Range("D2:D100").Value = yourjobs.Roledate.Value
Worksheets("Rolecheck").Range("F1").Value = yourjobs.Roledate.Value
Worksheets("JobRequirements").Range("E2:E100").Value = yourjobs.Roledate.Value

'to populate listbox  from Database sheet
   With Me.ListBox1
       .ColumnCount = 5
       .ColumnHeads = True
       .ColumnWidths = "120,120,120,120,120"
       .RowSource = "JobRequirements!A2:E" & iRow
       Sheets("Rolecheck").Visible = False
       Sheets("Home").Select
   End With
   'Now run & See
End Sub
 
Upvote 0
So in this line Roledate.Value = Format(Roledate.Value, "dd/mm/yyyy"), you are converting the date to TEXT.
I can't see where you are getting Roledate from. If it is from a Cell try using RoleDate.Value2 and don't use Format in VBA just Format the Column to "dd/mm/yyyy"
 
Upvote 0
See if this works for you.

Rich (BB code):
Private Sub showall_Click()
' ---------- Show All ---------------

Dim sh As Worksheet
Set sh = Sheets("JobRequirements")
Dim iRow As Long
iRow = sh.Range("A" & sh.Rows.Count).End(xlUp).Row

' ----- Changed Section -----
Dim dtRoleDate As Date
dtRoleDate = CDate(Roledate.Value)

Worksheets("Available").Range("D2:D100").Value2 = dtRoleDate
Worksheets("Rolecheck").Range("F1").Value2 = dtRoleDate
Worksheets("JobRequirements").Range("E2:E100").Value2 = dtRoleDate
' ----- End Changed Section -----

'to populate listbox  from Database sheet
   With Me.ListBox1
       .ColumnCount = 5
       .ColumnHeads = True
       .ColumnWidths = "120,120,120,120,120"
       .RowSource = "JobRequirements!A2:E" & iRow
       Sheets("Rolecheck").Visible = False
       Sheets("Home").Select
   End With
   'Now run & See
End Sub
 
Upvote 0
Solution
Works like a dream Alex, and it's not the first time you've helped me out thank you very much indeed 🙏
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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