IF STATEMENT WITH SUBTRACTING AND ADDING DATE

ChetanPuri

Board Regular
Joined
Sep 5, 2018
Messages
60
Office Version
  1. 365
Platform
  1. Windows
Hi Excel Gurus, trying to Build a forumla, where in example below: if date in column H3 is equal to less than 01 Jan 2024 then subtract H3- 01 July 2023 and divide the value in column Q/365 and multiply by number of days calculeted bewteen 2 days, otherwise 30 June 2024- H3 and then divide values in Column r and multiply by no. of days between 30 June & H3. Any help would be appreciated.
Salaries Budget 23-24 - 30 April 2023.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAA
11/07/20231/01/202430/06/2024
2Employee CodeSurnameGivenPosition NumberPosition TitleStart Date (with org)Contract Expiry DateAnniversary DateEmployee TypeHours/Fortnight (as at EOM, inc flexible arrangements etc)ClassificationStepCurrent SalaryDivision DescriptionNext StepNext Level Salary - FullNext Salary Level - Incudes P-T CalculationAs Per New EBAJuly to 31 December 2023Anniversry date to NEW EBAEBA to End of Financial YearTotal SalarySUPERA/L LoadingWork CoverSalary with Oncost
3303173Health Workforce Consultant4-Jan-224-Jan-24Secondment76.00L6199,357.00Health Workforce2105,290.00105,290.00107,395.80R3/36550,086.82882.7152,373.84103,343.3611,367.77417.352,066.87#########
431621Executive Coordinator3-May-223-May-24Permanent76.00L4177,112.00Health Workforce283,045.0083,045.0084,705.9038,872.9028,544.7313,460.1280,877.748,896.55326.621,617.5591,718.47
597173Health Workforce Consultant31-Aug-1731-Aug-23Permanent60.80L63109,305.00Health Workforce3109,305.0066,457.4467,786.59#VALUE!36,834.2933,614.72#VALUE!#VALUE!#VALUE!#VALUE!#VALUE!
6350178Health Workforce Support Officer8-Sep-228-Sep-23Permanent76.00L4177,112.00Health Workforce283,045.0083,045.0084,705.9014,366.0726,164.8642,004.8482,535.789,078.94333.321,650.7293,598.75
7207280Health Workforce Development Manager23-Apr-1923-Apr-24Permanent76.00L81125,793.00Health Workforce2130,360.00130,360.00132,967.20102,012.9541,165.1924,771.97167,950.1118,474.51678.263,359.00#########
833244Health Workforce Programs Manager8-Aug-228-Aug-23Permanent76.00L83134,927.00Health Workforce3134,927.00134,927.00137,625.5413,677.5353,970.8068,247.19135,895.5214,948.51548.812,717.91#########
917948Health Workforce Consultant8-Oct-188-Oct-23Permanent76.00L62105,290.00Health Workforce3109,305.00109,305.00111,491.1028,269.6425,454.5955,287.37109,011.6011,991.28440.242,180.23#########
10339320Health Workforce Support Officer29-Aug-2229-Aug-23Permanent76.00L4177,112.00Health Workforce283,045.0083,045.0084,705.9012,253.4128,440.0742,004.8482,698.339,096.82333.971,653.9793,783.08
1134661Health Workforce Support Officer5-Sep-225-Sep-23Permanent76.00L4177,112.00Health Workforce283,045.0083,045.0084,705.9013,732.2726,847.4242,004.8482,584.549,084.30333.511,651.6993,654.05
12296264Health Workforce Policy and Strategy Lead##################Permanent76.00L72117,152.00Health Workforce3121,830.00121,830.00124,266.6044,614.0514,686.3661,622.62120,923.0213,301.53488.342,418.46#########
13217296Health Workforce Coordinator - Locum29-Jul-1929-Jul-23Permanent76.00L5187,493.00Health Workforce293,426.0093,426.0095,294.526,472.0839,930.0247,255.6493,657.7410,302.35378.231,873.15#########
14314247Health Workforce Senior Coordinator - Outreach7-Mar-227-Mar-24Permanent76.00L6199,357.00Health Workforce2105,290.00105,290.00107,395.8067,780.5319,419.5133,837.03121,037.0813,314.08488.802,420.74#########
1533060Health Workforce Consultant20-Jul-2220-Jul-23Permanent76.00L6199,357.00Health Workforce2105,290.00105,290.00107,395.804,899.8047,596.8553,256.55105,753.1911,632.85427.082,115.06#########
1641248Health Workforce Coordinator - Education18-Sep-0618-Sep-23Permanent60.80L5396,036.00Health Workforce396,036.0058,389.8959,557.6920,522.7627,626.7929,534.0977,683.648,545.20392.151,553.6788,174.67
17277162Health Workforce Education Team Lead##################Permanent76.00L71111,221.00Health Workforce2117,152.00117,152.00119,495.0443,878.9712,517.6159,256.44115,653.0312,721.83467.062,313.06#########
18331319Health Workforce Coordinator - Policy and Strategy8-Aug-228-Aug-23Permanent76.00L5187,493.00Health Workforce293,426.0093,426.0095,294.528,869.1537,370.4047,255.6493,495.1910,284.47377.581,869.90#########
1922059Health Workforce Access Team Lead19-Aug-1919-Aug-23Permanent76.00L73121,830.00Health Workforce3121,830.00121,830.00124,266.6016,021.4845,060.4161,622.62122,704.5113,497.50495.542,454.09#########
2022447Health Workforce Engagement Team Lead23-Sep-1923-Sep-23Permanent76.00L72117,152.00Health Workforce3121,830.00121,830.00124,266.6026,640.0433,378.0861,622.62121,640.7413,380.48491.242,432.81#########
21364323Workforce Planning Consultant##################Permanent76.00L6199,357.00Health Workforce2105,290.00105,290.00107,395.8038,653.9611,827.1053,256.55103,737.6011,411.14418.942,074.75#########
2223050Future Health Workforce Consultant8-Oct-198-Oct-23Permanent76.00L62105,290.00Health Workforce3109,305.00109,305.00111,491.1028,269.6425,454.5955,287.37109,011.6011,991.28440.242,180.23#########
236652Health Workforce Coordinator19-Jul-9919-Jul-23Permanent55.60L5396,036.00Health Workforce396,036.0053,396.0254,463.944,472.9143,676.6527,008.1475,157.708,267.35414.891,503.1585,343.09
Sheet2
Cell Formulas
RangeFormula
S3S3=IF(AND(H3>=Summary!$B$3, H3<=Summary!$B$3),"Q3/365","R3/365")
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Anything placed between double-quotes is treated as literal text.
If you want to do the division, remove the double-quotes, i.e.
Excel Formula:
=IF(AND(H3>=Summary!$B$3, H3<=Summary!$B$3),Q3/365,R3/365)
but I don't see the subtraction part of your formula.
It seems that the parts like:
Excel Formula:
Q3/365
need to be something like:
Excel Formula:
(Q3-some value)/365

What exactly is in Summary!$B$3?
 
Upvote 0
AND(H3>=Summary!$B$3, H3<=Summary!$B$3)
I don't understand why you have that in your formula. The only way that H3 can be greater than or equal to Summary!$B$3 and also less than or equal to Summary!$B$3 is if it is exactly equal to Summary!$B$3

Other than that, remove the quote marks to allow the actual calculation to proceed, as Joe has suggested. So guessing that you might try

Excel Formula:
=IF(H3=Summary!$B$3,Q3,R3)/365
 
Upvote 0
I don't understand why you have that in your formula. The only way that H3 can be greater than or equal to Summary!$B$3 and also less than or equal to Summary!$B$3 is if it is exactly equal to Summary!$B$3

Other than that, remove the quote marks to allow the actual calculation to proceed, as joe has suggested. So guessing that you might try

Excel Formula:
=IF(H3=Summary!$B$3,Q3,R3)/365)
Good point, Peter. I did not analyze that part of the formula, as I was focusing on the result.
I am guessing that they are probably want to check two different dates, not the same one.
They also mentioned something about subtracting value before dividing, but were not clear where those values to be subtracted are coming from.
 
Upvote 0
Thank you Joe, much appreciated. Summary b3 is another worksheet, which is basically 01 January 2024. I was trying to build the salary budget, where up until anniversary date employees will get the current salary.past the anniversary date they will move on to next level column q and from 01 Jan 2024 they will be entitled to yearly increase based on inflation.
I was trying to build in column such as if anniversary date is less than 01 January 2024, it will calculate the number of days between anniversary date and 01 July 2023 and basically then calculate the salary for number days at current level.
If anniversary date is greater than or equal to 01 January 2024 when the new eba comes into effect then it should calculate current salaries from 31 Dec to 01 July 2023 and then from 01 January to anniversary date at a new rate without level increase.
 
Upvote 0
Thank you Joe, much appreciated. Summary b3 is another worksheet, which is basically 01 January 2024. I was trying to build the salary budget, where up until anniversary date employees will get the current salary.past the anniversary date they will move on to next level column q and from 01 Jan 2024 they will be entitled to yearly increase based on inflation.
I was trying to build in column such as if anniversary date is less than 01 January 2024, it will calculate the number of days between anniversary date and 01 July 2023 and basically then calculate the salary for number days at current level.
If anniversary date is greater than or equal to 01 January 2024 when the new eba comes into effect then it should calculate current salaries from 31 Dec to 01 July 2023 and then from 01 January to anniversary date at a new rate without level increase.
OK, based on the responses from myself and Peter, I think you should have all the information you need to amend you formula. Give it a try and see how you do.

If it does not work out, post back to this thread with the new formula you tried.
 
Upvote 0

Forum statistics

Threads
1,215,135
Messages
6,123,241
Members
449,093
Latest member
Vincent Khandagale

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