Formula not returning required value in one scenario

Sean15

Well-known Member
Joined
Jun 25, 2005
Messages
698
Office Version
  1. 2010
Platform
  1. Windows
Hi:
Formula in column E is returning required values, except in E9. If start date in A9 falls within date month in D1, formula in E9 should return prorate. Also could formula be shortened as it is becoming long and complicated. Thanks for your help.



Prorate month.xlsx
ABCDEFGH
1Date5/1/2022
2
3StartEndPaid
401/01/2204/28/22-1,200.00
502/25/2203/25/22-1,100.00
602/01/2103/01/22-1,500.00
702/15/2204/15/22-1,600.00
803/01/2205/01/2240.321,250.00
905/15/2208/12/22750.00required value 350.00750.00
1006/01/2212/07/22-1,450.00
1107/01/2212/31/22-1,600.00
12
Sheet1
Cell Formulas
RangeFormula
E4:E11E4=IF(B4<D$1,0,IF(A4>=EOMONTH(D$1,0)+1,0,IF(AND(B4>=D$1,B4<=EOMONTH(D$1,0)),(B4-D$1+1)/DAY(EOMONTH(D$1,0))*H4,H4)))
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Why should that be 350, all the If functions return false so it should return H9 which it does.
 
Upvote 0
@Fluff - you are correct. But I want to add an addition step where the formula will check dates in column A, and if the date falls within the date month of D1, prorate amount in column H where necessary. For example, since start date in A9 falls within date month of 05/01/2022 I want it to prorate. Hope this all makes sense
 
Upvote 0
What should the calculation be?
 
Upvote 0
Calculation should be:

(A4-D1+1)/DAY(EOMONTH(D$1,0))*H4
 
Upvote 0
Ok, how about
Excel Formula:
=IF(B4<D$1,0,IF(A4>=EOMONTH(D$1,0)+1,0,IF(AND(B4>=D$1,B4<=EOMONTH(D$1,0)),(B4-D$1+1)/DAY(EOMONTH(D$1,0))*H4,IF(MONTH(A4)=MONTH($D$1),(A4-D$1+1)/DAY(EOMONTH(D$1,0))*H4))))
but that does not return 350
 
Upvote 0
Yes, my mistake. E9 should return 362.90 not 350.00. I'm currently testing formula. Will let you know outcome.
Thanks for you help.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,678
Members
449,116
Latest member
HypnoFant

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