Datedif Function - excel

Reference to the snapshot, Scenario 1 - getting correct answer, but in Scenario 2 not getting the correct answer. Scenario 2 calculating the percentages of the total days. Could you please look it?

Related

Using IF with ROUNDDOWN, To Calculate How Many Times For A Process

I apologize if the title is a bit vague. I am trying to create a calculator that takes into account how much "scrap" I have, how much is needed to resmelt it, and how many bars recieved.
Currently using:
(=if((amtOwned/qtyToSmelt)<1,,rounddown((amtOwned/qtyToSmelt)*barsMade))
Table and Formula
The problem I am having is you MUST have the QTY to Smelt. But the value returned includes partial quantities.
Ex. 125 Bottle Caps should equal 4 Bars total. Yet it returns 5.
How can i make the formula only account for increments of the bars recieved?
Thank you for any help, again i apologize if this isn't that clear. Im not exactly sure how to express my need in this situation.
I have tried messing around with the syntax and where every argument sits, even this formula is the most recent iteration of what i thought would be needed.
EDIT: I have tried using the TRUNC function and this seems to be working as I need it to. The formula now is:
=TRUNC((AMTowned/AMTneeded),0)*barsRecieved
=TRUNC((136/50),0)*2 This is returning 2 bars instead of 3. Which is exactly what I need.
It appears this is working by truncating the number first then multiplying it. So, 1.5 becomes 1 before being multiplied. This was my guess after doing more research. I had been searching for a while before I posted this but am glad to have learned what I have in searching for this.
There is a tool for auditing formulas. To see it go to Formulas > Evaluate Formula.
So here is you formula =IF((E3/C3)<1,,ROUNDDOWN((E3/C3)*D3,0))
Have you tried the calculation on your regular calculator? To me it is doing what you would expect. (125/50)*2 = 5

Difference between DATEDIF unit "d" and "yd"

I am trying to understand how the difference between DATEDIF(date1,date2,"d") and DATEDIF(date1,date2,"yd") in excel. It is very confusing when trying to deal with leap year dates.
for example
=DATEDIF("2/29/2020","3/1/2021","yd") gives 0.
but when I try to give
=DATEDIF("2/29/2020","3/1/2021","d") gives 1.
and one more thing is
=DATEDIF("2/1/2020","3/1/2021","yd") gives 29 and
=DATEDIF("2/1/2019","3/1/2021","yd") gives 28.
Some of the articles claim that year of start date is used for calculations so with that logic DATEDIF("2/29/2020","3/1/2021","yd") should give 1 instead of zero. Can someone explain how the calculations are being done and what year is being considered for the calculations?
From the docs you can see what is the difference.
To be explicit, the YD variant isn't taking year into account, thus showing different results in the case of leap year.

Research data analysis in Excel: Column indexing

I need to analyse empirical research data:
Given the following data:
The explanation: 5 people answered Question 1 with "entirely agree", which is equivalent to a score of 7. Zero people answered Question 1 with "entirely disagree", which would be a score of 0.
I want now to calculate the number of responses strictly less than the Median and the number of answers equal to the Median.
The result should look like this (the Median is given thanks to Research data analysis in Excel: Median of x times column value)
I tried with the functions =INDIRECT and =INDEX; without success.
Would be great, if someone could help me. Thank you.
Use SUMIF:
Below:
=SUMIF($B$6:$H$6,"<" & I2,B2:H2)
Equal
=SUMIF($B$6:$H$6,"=" & I2,B2:H2)
A working, but not a better solution is to sum up the row conditionally:
the highlighted cell has this formula:
=IF(B6<I2,B2,0)+IF(C6<I2,C2,0)+IF(D6<I2,D2,0)+IF(E6<I2,E2,0)+IF(F6<I2,F2,0)+IF(G6<I2,G2,0)+IF(H6<I2,H2,0)
I hope it helps.

Excel - Separate formula for calculating different rates based on hours discussion

I am trying to calculate my hours based on the rate those hours were worked.
Right now my formula looks like:
=IF(AND(TEXT(D6,"dddd")=H4,J14>=48,O12="Yes"),D14*(G3*2),IF(AND(TEXT(D6,"dddd")=G4,J14>40),D14*(G3*1.5),G3*D14))
I know that D14 is not the proper cell to use, just what I had came up with to partially get this working.
What I need is to add if over 8 hours calculate at this rate, if day 1 off calculate it all at 1.5 and if second day off calculate it at 2x rate. the equation I stated above is a working if for the days off part, i just need help with the rate part.
Managed to figure it out, from here i can figure out what equation I'll need for the false.
=IF(AND(TEXT(E6,"dddd")=H4,J14>=48,O12="Yes"),E14*(G3*2),IF(AND(TEXT(E6,"dddd")=G4,J14>40),E14*(G3*1.5),IF((E10-E7+(E10<E7)-(E9-E8))*24>8,(E11*G3)+(E12*(G3*1.5)),FALSE)))

how to specify the first cell with data in it inside an if statement in Excel

I keep a running avg of kids grades in Excel over a 2 week period. The way i have the code now
AVERAGE(OFFSET('1'!E4,COUNTA('1'!D:D)-29,):OFFSET('1'!E4,COUNTA('1'!D:D),))
it returns an error if i don't have 2 weeks of data. I found a way around this by doing this
=IFERROR(AVERAGE(OFFSET('1'!E4,COUNTA('1'!D:D)-29,):OFFSET('1'!E4,COUNTA('1'!D:D),)),IFERROR(AVERAGE(OFFSET('1'!E4,COUNTA('1'!D:D)-28,):OFFSET('1'!E4,COUNTA('1'!D:D),)),IFERROR(AVERAGE(OFFSET('1'!E4,COUNTA('1'!D:D)-27,....
Im Sure there is a better way to do this any help would be appreciated.
As pointed out in the comments - it's difficult to give a definitive answer without some more knowledge - it's not easy to tell, for instance, where the numeric data starts (E4 or E5)?
Firstly you can simplify your original formula which appears to AVERAGE the last 30 rows of data (not sure how 30 rows equates to 2 weeks of data) - you can do that with just:
=AVERAGE(OFFSET('1'!E4,COUNTA('1'!D:D)-29,0,30))
Now I assume the error comes about when COUNTA('1'!D:D) is < 29 so you can simply add an If function which AVERAGES all the data if that function returns a number < 29, i.e.
=IF(COUNTA('1'!D:D)<29,AVERAGE('1'!E4:E33),AVERAGE(OFFSET('1'!E4,COUNTA('1'!D:D)-29,0,30)))
That formula may need some small adjustments to cater for the specifics of your layout but the general approach is valid

Resources