Date With If Function

L

Legacy 116183

Guest
I am trying to use an If function with dates but can't seem to crack it.

What I want is: If today's date is later than 28/3/2022, then divide by 31. If it is before 31/3/2022, then divide by the number of days in the month which have elapsed.

I'm trying something like

=(B17/IF(TODAY()<DATE(2022,3,31),31,(2022,3,31)-today())) but not having any success

Any thoughts please?
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi, In my opinion I think later than 28/2/2022 and before 31/3/22 is nearly the same. there is just a difference of two days. Or if it is specific you should use IF and AND function
 
Upvote 0
You appear to have misread it I'm afraid.

There are 31 days between the 28th Feb and 31st March.

I'm am trying to divide something by the number have days which have elapsed in the month, but of the entire month has passed, I want it divided by the number of days in the month
 
Upvote 0
Sorry it was a typo . But your question mentioned 28/3/22 and 31/3/22
From what I understand
You have a value of say 10,000 in B17
If the month is finished you want to divide it by the number of days in the month
If it has not finished you want to divide by number of days which have passed.
Am I Right ?
Kindly correct me if I am wrong
 
Upvote 0
Sorry it was a typo . But your question mentioned 28/3/22 and 31/3/22
From what I understand
You have a value of say 10,000 in B17
If the month is finished you want to divide it by the number of days in the month
If it has not finished you want to divide by number of days which have passed.
Am I Right ?
Kindly correct me if I am wrong
Yes, that is right.
 
Upvote 0
Kindly Try This

=B17/IF(TODAY()>=DATE(2022,3,31),31,DAY(TODAY()))
 
Upvote 0
Solution

Forum statistics

Threads
1,215,432
Messages
6,124,858
Members
449,194
Latest member
HellScout

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