If statement based on date

still learning

Well-known Member
Joined
Jan 15, 2010
Messages
782
Office Version
  1. 365
Platform
  1. Windows
Hi
I'm trying to write an if statement base on a date
VBA Code:
=if(a1="Oct-05",1,"")
A1 is formatted mmm-dd
Oct-05 is typed in as 10/5 and excel defaults to 2020
I get a result of a blank cell
I tried to wriite the if statement using 10/5/2020 instead of Oct-05 but it still doesn't work
I also tried to (with the date in A1) copy and paste >>special>>values

Also, did I use the right icon to "set-off" the if statement?????


mike
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Try using
Excel Formula:
=if(a1=--"Oct-05",1,"")
Dates are numbers not text, when you enter them in a formula in double quotes the text needs to be converted to a numeric value.
 
Upvote 0
Hi Jasonb75,
Thanks, I never saw or knew about using -- in an if statement

Mike
 
Upvote 0

Forum statistics

Threads
1,214,530
Messages
6,120,071
Members
448,943
Latest member
sharmarick

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