SharePoint IF AND OR formula - sharepoint

I have been working on a calculated column formula and have gotten stuck.
I have a list with several columns the formula is looking at.
First column is a Due Date column that is a simple calculated column of Created date + 4 days
The Second column is a Completed column. The three options here are empty(blank), Working and Yes
The formula I'm working on is for a Reassign column which will ether be a Yes or No. The conditions are If the Due Date is greater than the Modified date and the Completed column is ether Working or empty(blank) then the Assigned column should be No. IF the conditions are not met then reassign column should be Yes
The below formula works except if the Completed column is empty(blank). I've tried using ISBLANK but have had no luck. I believe it maybe a simple formatting issue but any help would be greatly appreciated.
=IF(AND([Due Date]>Modified,OR(Completed="Working",Completed=" ")),"No","Yes")

Your calculated formula would work with using ISBLANK
IF(AND([Due Date]>Modified,OR([Completed]="Working",ISBLANK([Completed]))),"No","Yes")
I always try to use ISBLANK, instead of checking for =" ".

To make things simpler, I would flip your logic. Instead of checking that Completed is blank or "Working", check that it's not "Yes".
=IF(AND([Due Date]>Modified,NOT(Completed="Yes")),"No","Yes")

Please try with this:
=IF(AND([Due Date]>Modified,OR(Completed="Working",Completed=0)),"No","Yes")

Related

How can I fix this Excel formula in ordert to exlude rows from calculation when two different columns has a specific value?

I am not so into Excel and I am finding the following difficulty trying to adapt a pre-existing formula to a new requirement.
Basically I have this original formula (workiong fine):
=SUMPRODUCT((D2:D7)*(B2:B7="BUY"))/SUMPRODUCT((G2:G7)*(B2:B7="BUY"))
This basically calculate an avarange price checking that the value of the B column is "BUY" (basically to exclude when the row is a SELL row). It works fine.
Now I have to change the previous formula excluding also all the row having the H column having value different from "CC". I have try in this way:
=SUMPRODUCT((D2:D7)*(B2:B7="BUY" AND H2:H7="CC"))/SUMPRODUCT((G2:G7)*(B2:B7="BUY" AND H2:H7="CC"))
Basically I tried to add an AND condition checking if the H column value is CC. But it is not working. It give me a syntax error when I try to insert this second version of my forumula.
Why? What is wrong? What am I missing? How can I fix my formula?
AND is used AND(crit1,crit2) not crit1 AND crit2.
AND will not work in this case.
Use * instead:
=SUMPRODUCT((D2:D7)*(B2:B7="BUY")*(H2:H7="CC"))/SUMPRODUCT((G2:G7)*(B2:B7="BUY")*(H2:H7="CC"))
For AND either use this logic: AND(B2:B7="BUY",H2:H7="CC") or (B2:B7="BUY")*(H2:H7="CC") in the second one * stands for AND, but as pointed out by Scott Craner in array formulas (such as SUMPRODUCT) you have to use *.

Excel - issue with VLOOKUP formula - it doesn't pick dates

I need help with the below formula. I already tried to find a solution for this problem but no success.
If account number exists in column A in the 'Returns' tab and also in column A in the 'July Sales' tab, then I need to get date from the column B in 'Returns' tab.
I manually checked a few accounts on both spreadsheet and find some duplicates.
My formula is as follows:
=VLOOKUP(Returns!A:B,A:B,2,0)
Screenshots:
I tried to change format to text/general, text to columns and trim function but it's still not working.
Also, as I have over 200k rows in each table, can I use any different formula instead to speed this up?
Finally, is there any way to pick dates only if these are within 30 days
Thanks in advance.
You're using Returns!A:B as your lookup value, which doesn't make sense. Instead, try the following:
=VLOOKUP([#Account], tblReturns[[Account]:[Submit_Date]],2,FALSE)
where tblReturns is the name of the table on your Returns worksheet.
I've made the assumption that you're working with tables, since the data in your screenshots is formatted like the default table. If they're just normal ranges, the equivalent is
=VLOOKUP($A2,Returns!$A:$B,2,FALSE)
=IF(COUNTIF(RETURNS!A:A,A2)>0,B2,"NO RETURN INFO")
Not sure what you want done when the account is not found on the RETURNS worksheet. Change "NO RETURN INFO" to what ever text you want including "" for a blank. Make sure you apply the same format for cells in column F as you do in column B. Copy the above formula down as required.
try the below, which will return blanks for non-matches as opposed to errors;
=IFERROR(VLOOKUP($A2,Returns!$A:$B,2,FALSE),"")
I highly recommend an INDEX/MATCH combination over a VLOOKUP. It is MUCH faster, particularly if you are working with a large number of rows. It may even be faster than the COUNTIF solution suggested by #ForwardEd.
=IFERROR(INDEX(Returns!$B:$B,MATCH($A2,Returns!$A:$A,0)),"")

Compare rows across 2 columns and count value once if it appears twice all within a date range

hope someone can help on this problem I've hit a brick wall with.
I'm creating a quarterly report, so I need to firstly check that the formula looks at the correct date range. I have been using the following so far:
=COUNTIFS($A:$A,">="&B$5,$A:$A,"<="&B$6,$D:$D, "YES")
This has been working great, but now I need to compare 2 columns within the date range and only count 1 of the YES's if it appears in both rows.
Not sure if that makes complete sense, so here's an example.
Example
In the above, I would need to look at the date range 03/02/16 to 06/02/16, compare column 1 and column 2 and only count the YES once if it appears in both columns. So in the above, the value would return 4.
And I'm using Excel 2007.
Any help would be much appreciated!
Thanks in advance
Chris
Assuming the dates are in B5 and B6 and the columns to check for yes are C and D:
=SUMPRODUCT((A2:A9<=$B$6)*(A2:A9>=$B$5)*(( D2:D9="YES")+(C2:C9="YES")>0))

SUMPRODUCT several ifs

I´ve spent a lot of time with a formula in Excel and I´m still blocked. I hope you can help me.
I have a table in Excel with several values as shown in this
screenshot.
What I´m trying to extract is the number of Fruits sold in a specific month. That is, how many lemons were sold in January 2016, for example. This is the formula I´m using:
=SUMPRODUCT((B3:B38=E4)*(MONTH($A$3:$A$150)=12)*(YEAR($A$3:$A$150)=2015);$C$3:$C$150)
But the result is #N/A as seen in the screenshot.
What Am I doing wrong? Any help, please?
Thanks a lot in advance!
You can use arrays in excel to get this answer
{SUM(IF(MONTH(F$3&"1")=MONTH($A$3:$A$150),IF($E4=$B$3:$B$150,$C$3:$C$150,0),0))}
You can use this Sumproduct formula which uses array logic:
SUMPRODUCT((MONTH($A$3:$A$38)=MONTH(TEXT(G$2,"MMM")&1))*($C$3:$C$38=$F4)*
($D$3:$D$38))
Sumproduct Demo
Part of your problem is your ranges are not equal in length. B3:B38 has to be the same number of rows as $A$3:$A$150 and C3:C150. When rows are not equal things blow up on you.
=SUMPRODUCT(($B$3:$B$150=$E4)*(MONTH($A$3:$A$150)=12)*(YEAR($A$3:$A$150)=2015);$C$3:$C$150)
if you change your header row to be actual excel date format, and then change the cell display format to just show the month (as suggested by csanjose), then you can adjust your sumproduct formula as follows and copy to all cells in your table.
=SUMPRODUCT(($B$3:$B$38=$E4)*(MONTH($A$3:$A$150)=Month(F$3))*(YEAR($A$3:$A$150)=Year(F$3));$C$3:$C$150)
Fill your month-row with the last day of each month, then apply date format to show only month name.
The formula you should use is, for example, in g8:
=SUMIFS($C:$C;$B:$B;$E8;$A:$A;"<="&G$3;$A:$A;">"&F$3)
First column "F" doesn't have a column on the left to compare, so you can put a date in E3 or change a bit the formula (example of F8):
=SUMIFS($C:$C;$B:$B;$E8;$A:$A;"<="&F$3;$A:$A;">2015/12/31")
Take a look at the result
If you don't want to use a pivot table, you can use this formula to get what you need:
=SUMPRODUCT(($B$3:$B$150=$E3)*(MONTH($A$3:$A$150)=1)*(YEAR($A$3:$A$150)=2015)*$C$3:$C$150)
Then drag-fill the cell to copy it to every month column (just make sure you change the month number in the formula (and year if you're doing that too)), and then drag-fill down the columns.
That should work pretty food good :)
Good Luck!

Counting Cells in a Range that Contains Formulas, Only when a Date is Returned?

Frequent browser, first time poster. Please go easy:
I have spent the last few days searching online, and on here for a solution to a problem I have encountered for the first time. I have a report that pulls from multiple worksheets. One column is a formula that does a VLOOKUP to another sheet and pulls back a date, if it exists. I then have a cell at the top of the sheet that calculates how many dates are pulled back out of all of the rows (to calculate % complete). This is where I am having the problem. I have tried variations of COUNTIF, COUNTA, COUNTBLANK, and so on, and formulas trying to reverse calculate,
=SUM(C4)-COUNTIF(Table3[2014 Process Date],"")
At first it appeared to work, but in this example, I had 1949 rows, and dates only populated in 7 of those rows. In theory it should return 7. Instead it is returning 237. I have done multiple filters, and manually reviewed the data in the column, and only 7 dates are there. The column has the VLOOKUP in and IFERROR nest,
=IFERROR(VLOOKUP(A12,Table_TaxData.accdb3[#All],240,FALSE),"").
I am guessing I am overlooking something silly, and was hoping someone would be able to help steer me in the right direction, or let me know what I am missing. Thanks in advance for any help!
Wow, looks like I need some more coffee! Thank you, I guess I assumed that it would be much more complicated than that. I just threw in
=COUNT(Table3[2014 Process Date])
And it worked like a charm! Thanks again!
If I'm reading your formula correctly, the target cells hold either the DATE, or a blank "".
If so, you can do a COUNTIF and do this:
=COUNT(B:B)
to get # of dates.
or
=COUNTA(B:B)-COUNT(B:B)
to get # of blanks.
(I used column B, not sure where your final values are in you're looking for - adjust accordingly)

Resources