I would like to solve some syntax error due to lack of skills. I would like to bind this weekday check with one formula.
This is wrong and I need to sum up the (W11/X11*Y11*1.25) part and showing the day of transaction is only on weekday and not weekend on Z11. Meaning to say I need to bind this formula together and then sum for the rest blanketed columns on Cell Z11.
=((T11/X11)*Y11)+((U11/X11)*Y11*1.25)+((V11/X11)*Y11*1.5) with =IF(AND(WEEKDAY(A11)>=2, WEEKDAY(A11)<=6), (W11/X11*Y11*1.25))
Thank You In Advance
=IF(WEEKDAY(A11)=2,"Monday",IF(WEEKDAY(A11)=3,"Tuesday",IF(WEEKDAY(A11)=4,"Wednesday",IF(WEEKDAY(A11)=5,"Thursday",IF(WEEKDAY(A11)=6,"Friday")*(W11/X11*Y11*1.25)))))
No error message, the syntaxs is wrong
Your formula does not produce a syntax error for me. It returns the day of the week in words and it works exactly as written.
In the IF statements you return the day name as text. The text for Friday is then multiplied by (W11/X11*Y11*1.25) . Since text will not be multiplied with numbers, the result is still text.
You probably don't want this. You probably want the calculation to occur only for weekdays, so you could use a formula like this
=IF(and(WEEKDAY(A11)>=2,WEEKDAY(A11)<=6),(W11/X11*Y11*1.25),"no calculation")
In words: if the number of the weekday is between 2 and 6, do the calculation.
Related
I am trying to find a (reasonably elegant) formula to find out how often a date appears in a list of date ranges.
In my example I have 4 date ranges, defined by a start date (A2:A5) and by an end date (B2:B5). Below I have a list of dates for which I would like to know how often a date appears in any of those 4 ranges. The only solution I came up with was to check for each range if the date is in there. The formula becomes quite lengthy with the number of periods and is not flexible if more periods are added later.
Here the time periods:
And here where I try to retrieve the number of matches given a date:
My formula is here for B11 (yielding 3 given the input of 10/Sep/2021):
=IF(AND($A11>=$A$2,$A11<=$B$2),1,0)+IF(AND($A11>=$A$3,$A11<=$B$3),1,0)+IF(AND($A11>=$A$4,$A11<=$B$4),1,0)+IF(AND($A11>=$A$5,$A11<=$B$5),1,0)
Any ideas appreciated!
Using COUNTIFS:
=COUNTIFS($A$2:$A$5,"<="&A11,$B$2:$B$5,">="&A11)
I am trying to find a difference between 2 dates using networkdays and additionally if both dates are equal, have to make the value as 0. But unable to get the result.
You can try
if(DATEVALUE(A1)=DATEVALUE(A2),0,NETWORKDAYS(A1+1,B1)
#Ron Rosenfeld has pointed out that my testing led to wrong conclusions. Therefore I increased the volume of my tests. They continue to show that ...
Comparing the two dates and adding a day gives erratic results, and that
The naked NETWORKDAYS function as designed by Microsoft gives the most useful result.
In the table below the original function is in column C, your function (modified to work by #Ron Rosenfeld) in column D and two variations thereof in columns E and F. The lower part of the table shows results where both days are the same while the dates are 2 days apart in the upper part.
The tables show that the original formula counts both the start and the end days as well as all days between them, subtracting weekend days, except when start and end days are the same. In other words, the original function already treats the case of A1=B1 differently.
However, if an adjustment is to be made it should preferably be made to the result of the formula, not be modifying the date before they are processed. This is demonstrated in column F.
The formula in column E takes up your attempt to modify one of the dates (the end date could be modified too) and makes this conditional. The difference as compared to your formula is that you apply in fact two separate calculations, one where the result is always 0 (when dates are equal) and the other where the start date is advanced by one day unconditionally. If it suits your purposes that method can still be applied but the formula in column E shows how the date modification can be made conditional.
The need to apply conditions arises from the essential shortcoming of your formula in that it applies the wrong condition. Different treatment for when dates are equal is already incorporated in the basic function. Any further modification must take the involved weekdays into account, not (necessarily) only the interval between the dates.
Why do you put your formula arguments in quotes? That just changes them into strings, which is why your formula doesn't work.
I assume from your formula that you just don't want to count the first day. In which case it will work as you have it, if you merely remove the double quote marks.
I have created the formula
=-1+NETWORKDAYS(I18;J18;Helgdagar!A8:A35)
to calculate the difference between two dates. Standard Excel behaviour is that if it is the same date in both columns, it shows the value 1 but I want to display the value 0 instead (hence the -1+ in the beginning).
So far so good. The problem I have with this formula is if the date in J-column comes before the date in I-column. Let's say that it says April 8th in the J-column and April 10th in the I-column. Then it should say -2 but instead it says -3. How can I solve this?
=-1+IF(J18<I18,NETWORKDAYS(J18;I18;Helgdagar!A8:A35),NETWORKDAYS(I18;J18;Helgdagar!A8:A35))
Put an if statement in to compare which is the smaller value and then use the appropriate formula that works for you.
This is a way I have used:-
=NETWORKDAYS(I18;J18;Helgdagar!A8:A35)-sign(NETWORKDAYS(I18;J18;Helgdagar!A8:A35))
So it subtracts 1 if the NETWORKDAYS result is positive (including the case when both dates are the same) and adds one if it is negative.
I'm trying to count rows where the date in a Date column falls within a particular month. I've tried many paths but all result in an error in my formula. They boil down to me trying to do this:
=countIF(Month(SHData[#MS550]),MONTH(SHData[#MS550]))
My final formula will need to be more complex than that, but even something as simple as the above generates an error. I've also tried it with Text(Date,"MMMM") with the same results.
Would be easier with COUNTIFS but with COUNTIF you might count all the entries greater than or equal to the start of your chosen month, then subtract from that the count of all the entries after the end of your chosen month. Something like:
=COUNTIF(SHData[MS550],">42004")-COUNTIF(SHData[MS550],">42036")
for January this year, if using the 1900 date system.
Try using SumProduct, this just worked fine for me with a column of dates testing if they were in September:
=SUMPRODUCT(--(C3:C5>0),--(MONTH(C3:C5)=9))
I want to program a cell to calculate the number of days I have left before I meet a deadline.
I would like to do this without reference cells, unlike this tutorial.
An (incorrectly formatted) example of the kind of formula I want would be:=(3/2/2015-TODAY()), where 3/2/2015 is my deadline. This yields some negative serial number,-42051.00, which yields a #NUM! error when put into the DAY formula.
Any idea how to do this without putting TODAY() and 3/2/2015 into their own reference cells? I would like to use functions to keep these paraments completely embedded in the formula.
Right clock the cell with the answer and reformat it as NUMBER. You want to use the Days function not the date function.
=DATE(2015,3,2)-TODAY() is what you want, but I would recommend doing the date in a separate cell for a number of reasons and using "today()" in the formula.
EDIT: Anyone trying to find midpoints would use the date function in this case.
Also, as a general rule for people trying to subtract dates the two trouble shooting methods you want are
A) Check your format-If you want number of dates, it needs to be set as number, if you want a date, you need it to set as date. If you get a long decimal it means you have it formatted as general OR your expression returns a date value rather than a number value. Refer to my original answer.
B) Reverse your dates. Depending on the function and what you want, you may need to move the dates around.
=DATEDIF(DATEVALUE("03/02/2015"), TODAY(), "d")