destiny4adams

New Member
Joined
Jul 4, 2023
Messages
14
Office Version
  1. 2016
Platform
  1. Windows
The formula I am using is not calculating correctly. What am I doing wrong?

=IF(C5=0,"",IF(C5>0,SUM(C5-20),IF(A5="*Nov*",A5="*Dec*",A5="*Jan*",A5="*Feb*",SUM(C5-98))))

What I am looking for is, if cell C5=0 then leave blank, if cell C5>0 then subtract 20 from cell C5, and if cell A5 contains Nov subtract 98 from C5.

The results I am looking for are:
I need cell G (How many days over) to calculate how many days Shawn worked over his contract days, which is, 20 days at work, 10 off, except during Nov-Feb then it is 98 days at work, 0 days off.

I need cell O (How many days under) to calculate how many days less than Shawn's contract is for being off work.
1688510935020.png


I tried to open the XL2BB, so I could upload my sheet, but I keep getting an error saying it cannot open in protected view (my workbook is not protected).
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Welcome to the MrExcel board!

I tried to open the XL2BB, so I could upload my sheet, but I keep getting an error saying it cannot open in protected view
See if this helps XL2BB Icons greyed out

and if cell A5 contains Nov subtract 98 from C5.
So what are *Dec*, *Jan* etc in the formula for?

Are the dates in column A actual dates or text? In a blank cell, what does this formula return? =ISNUMBER(A5)

Are the values shown in "How many days over" in your picture the results you want for that sample data?
 
Upvote 0
I was told that * was a wild card and if you don't know where in the reference cell the information will appear then you are supposed to put * before and after the word you are looking for.
 
Upvote 0
I was told that * was a wild card and if you don't know where in the reference cell the information will appear then you are supposed to put * before and after the word you are looking for.
Yes the dates are actual dates, that is just a format that I chose
 
Upvote 0
Thanks. Try the formula below.

BTW, did you try my suggestion about XL2BB? You will generally get much faster/better responses if you can provide your sample data that way. :)

23 07 05.xlsm
ACG
518-Sep-20224323
613-Nov-202214648
716-Apr-2023288
828-May-2023244
902-Jul-2023277
10 
Days over
Cell Formulas
RangeFormula
G5:G10G5=IF(A5="","",C5-IF(OR(MONTH(A5)={11,12,1,2}),98,20))
 
Upvote 0
Solution
Thanks. Try the formula below.

BTW, did you try my suggestion about XL2BB? You will generally get much faster/better responses if you can provide your sample data that way. :)

23 07 05.xlsm
ACG
518-Sep-20224323
613-Nov-202214648
716-Apr-2023288
828-May-2023244
902-Jul-2023277
10 
Days over
Cell Formulas
RangeFormula
G5:G10G5=IF(A5="","",C5-IF(OR(MONTH(A5)={11,12,1,2}),98,20))
I did try and it still would not work. I followed the instructions and I now have the button on the ribbon, but it doesn't work.
 
Upvote 0
Thanks. Try the formula below.

BTW, did you try my suggestion about XL2BB? You will generally get much faster/better responses if you can provide your sample data that way. :)

23 07 05.xlsm
ACG
518-Sep-20224323
613-Nov-202214648
716-Apr-2023288
828-May-2023244
902-Jul-2023277
10 
Days over
Cell Formulas
RangeFormula
G5:G10G5=IF(A5="","",C5-IF(OR(MONTH(A5)={11,12,1,2}),98,20))
Thank you so much that is exactly what I needed! You are such a good help, Peter!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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