I am trying to write a nested IF statement in excel and struggling to get it right.
My formula is looking for a value "NA" in specific cells of my row and if the condition is TRUE, then it should subtract a specific number in the division and if the condition is not TRUE then it should not subtract the number from the division .
for example if J10="NA" is true then (CC10/CC4-K4 )% otherwise it should be (CC10/CC4)%.Likewise if J10="NA" is false and R10="NA" is TRUE then my division part should be (CC10/CC4-S4 )% and should not include the cell 'K4'. I hope I was able to make it clear??
Below is my formula:
=IF(OR(J10="NA", R10="NA", Z10="NA"),(CC10/($CC$4-K4-S4-AA4)%), CC10/CC4%)
I think this is what you're looking for:
=CC10/($CC$4-(J10="NA")*$K$4-(R10="NA")*$S$4-(Z10="NA")*$AA$4)%
Related
Am hoping I can get some help with a VBA code sample to look up specific values in multiple columns (4 to be exact) and populate a specific text in another column (outside of the first 4). This is all happening within 1 single worksheet. See below for 4 criteria and specified verbiage to be populated:
column 1 value: "Yes"
column 2 value: "Yes"
column 3 value: "R" or "S"
column 4 value: Begins with "9" or "88"
IF all criteria are met, then populate "AWP Review".
I use my excel in spanish, but I'll try to translate the fomula
I guess you can write this formula to filter and copy and paste later
other way would be record a macro, filtering from left to right using your criteria
if I have a wrong idea let me know
=SI(SUMA(CONTAR.SI.CONJUNTO(A2,"YES",B2,"YES"),SI(O(C2="R",C2="S"),1,0),SI(O(D2=9,D2=88),1,0))=3,"SOME TEXT","")
=IF(SUM(COUNT.IFS(A2,"YES",B2,"YES"),IF(OR(C2="R",C2="S"),1,0),IF(OR(D2=9,D2=88),1,0))=3,"SOME TEXT","")
I'm not sure if this is possible but as you can see I have a pivot table with multiple dependent and expandable fields. I am trying to concatenate the data from columns A:D into one cell which works fine in row 2 but doesn't work with blank parent cells, as you can see in column F.
Any ideas for how to achieve this?
Pivot table
This answer assumes that you don't want to just Repeat All Item Labels in the PivotTable from the "Report Layout" drop-down on the Pivt Table Tools "Design" tab.
A formula to get the first non-blank value on or above the same row as the current cell from Column B can be constructed with a combination of AGGREGATE, SUMPRODUCT and OFFSET, like so:
=OFFSET($B2,SUMPRODUCT(AGGREGATE(14,6,ROW($B$1:$B$100)*--(ROW($B$1:$B$100)<=ROW())*--(LEN($B$1:$B$100)>0),1))-ROW(),0)
How does it work?
Starting with the outermost part, OFFSET($B2, VALUE, 0) - this will start in cell B2, then look up or down by VALUE rows to get the value.
Next we need to know how many rows we will need to look up-or-down. Now, if we can work out the bottom-most row with data, we can subtract the current ROW() from that, giving us OFFSET($B2, NON_BLANK-ROW(),0)
So, to finish up we need to work out which rows are not blank, AND which rows are on-or-above our current row, then take the largest of those. This is going to take an ArrayFormula, but we can use SUMPRODUCT to make that calculate properly. To find the largest number we could use MAX or LARGE - but we get less errors if we pick AGGREGATE(14,6,..,1). (The 14 means "we want the kth largest number", the 6 means "ignore error values", and the 1 is k - so "we want the largest number, ignoring errors")
But, what list of numbers are we going to look at, I don't hear you ask. Well, we want the ROW for output from our range (I'm using $B$1:$B$100, because using the whole column B would take far to long to calculate repeatedly), a comparison against the current ROW(), and check that the LENgth is > 0. Those last two are comparisons, so let's write them out first:
ROW($B$1:$B100)<=ROW()
and
LEN($B$1:$B$100)>0
We want to use -- to convert TRUE and FALSE to 1 and 0 - this means that any "bad" values become 0, and any "good" values are larger than 0:
ROW($B$1:$B$100)*--(ROW($B$1:$B$100)<=ROW())*--(LEN($B$1:$B$100)>0)
This gives us the Row number when the Row is on-or-before the current row AND Column B is not blank - if either of those are False, then we get 0 instead. Stick that in the AGGREGATE to find the largest number:
AGGREGATE(14, 6, ROW($B$1:$B$100)*--(ROW($B$1:$B$100)<=ROW())*--(LEN($B$1:$B$100)>0), 1)
Then put it in a SUMPRODUCT to force Excel to treat it as an ArrayFormula, and that's your NON_BLANK. This then gives you that first formula right at the top of the post
I'm trying to calculate a cell base on a cell which is conditionally formatted.
I've use IF statement to calculate the price per box if the ICO (ICO is our term for average order per 3 months) is Conditionally formatted (I use gray color and bold it to diplay that it is in Case and not per piece) , if it's not bold the cell must calculate the price per piece. I've tried using the VBA that returns the value True or False if the selected cell is conditionally formatted even if the condition is not met. You have any idea how to display true or false if the condition is met by the cell?
I have the following sheet called DailyReport:
I am currently calculating Column M with:
=SUMPRODUCT(A2:A200=A2, G2:G200)
Then on a secondary sheet I have the following second sheet WeeklyReport:
Now what I want to do is, if WeeklyReport Column A2 == DailyReport Column A, then take the date in DailyReport Column B and test it to fall in the date range in WeeklyReport Column B and Column C with:
=IF(AND(DailyReport.B2>=B2,DailyReport.B2<=C2),1, 0)
and if that is true add the Total Daily Hours to the total in WeeklyReports Column D from DailyReports Column M.
I think summing values from column M, which is itself a sum, would not meet the goal. Summing sums would make too big a value, and column M is not filtered by date, so numbers from the wrong dates would be included.
I like better the idea of extending the way you used SUMPRODUCT to get the column M numbers. Instead of just checking for a matching name, add two more parameters to check for a date later or equal to the "Week Start Date" and earlier or equal to the "Week End Date".
So three true/false or 1/0 parameters (where multiplying by 1 for true keeps the value and multiplying by 0 for false removes the value) and the fourth parameter of the hour values to be summed:
=SUMPRODUCT(DailyReport.A$2:A$200=A2, DailyReport.B$2:B$200>=B2, DailyReport.B$2:B$200<=C2, DailyReport.G$2:G$200)
The poster also came very close to a solution using SUMIFS (in the comments). The default condition test is =, but for the date comparisons we want to use greater than and less than operators. The LibreOffice/OpenOffice syntax for this is to put the relational operators in double quotes, then use & to connect them to the cell address that contains the test value:
=SUMIFS(DailyReport.G$2:G$200, DailyReport.A$2:A$200, A2, DailyReport.B$2:B$200, ">=" & B2, DailyReport.B$2:B$200, "<=" & C2)
In both these cases I have included $ signs to make the row numbers absolute. Absolute cell addresses will not change if the formula is copy-pasted; in this case the copy-paste might be over multiple rows on the WeeklyReport sheet to get hour totals for multiple people.
I'm looking to generate a report to list the number of Cities/Towns that don't meet a certain criteria so on Sheet 2 I have an alphabetical list of all the cities/towns.
I want to do a look up/count if function to state if A2(Sheet 2) can be found anywhere in Column D on Sheet 1 then count it if the date in column L (sheet 1) matches the date in Cell $E$1 (sheet 2) and Column A in Sheet 1 is greater than zero.
I originally done this formula but it is returning an error.
=COUNTIFS(PickData!D:D,Sheet1!A2,PickData!L:L,Sheet1!$E$1,PickData!A:A,PickData!A:A>0)
Is there any other formulas that I'm currently not thinking of? Or is it possible to do this via VBA and it returns the value in to column B either True if it matches or False if it doesn't?
Thanks
Al
The problem with your previous formula is in the final criteria. Update to:
=COUNTIFS(PickData!D:D,Sheet1!A2,PickData!L:L,Sheet1!E2,PickData!A:A,">0")