conditional median in excel worksheet - excel

I want to calculate a conditional median.
The formula =MEDIAN(K3851:K4792;$O3851:$O4792) works.
The step I cannot make is the one where the calculation
is restricted to when K<1. It seems easy enough, but I get
the error code "#NAME?".
I would greatly appreciate your help.

You can use an array formula¹ to set up the condition. The array formula will pick up blank cells so you will have to add a condition to discard them as well.
=MEDIAN(IF(K3851:K4792<1; IF(K3851:K4792<>""; $O3851:$O4792)))
PROOF
        
¹ Array formulas need to be finalized with Ctrl+Shift+Enter↵. Once entered into the first cell correctly, they can be filled or copied down or right just like any other formula. See Guidelines and examples of array formulas for more information.

Related

Copying conditional formatting with VLOOKUP across columns

I am formatting cell D25 using the following conditional formatting formula:
=(VLOOKUP($C25;$C$6:$L$18;2)+D25)>32
When applying the formula to the adjacent column I get formula updates to
=(VLOOKUP($C25;$C$6:$L$18;**2**)+E25)>32
Using the Copy and Paste Format function works mostly i.e. references in the formula are updated as I would expect.
The only (essential) thing that doesn't update is the INDEX value in the VLOOKUP formula. I would expect this value to increase by 1 when copying the format to the next column - it doesn't.
Is there any way to go around this issue with VLOOKUP? Is there a better suited formula to achieve the same result?
Any help will be greatly appreciated!!
This value does not increase automatically, and it is good. This formula was designed to be used on Tables, so consistency is a point here.
For conditional formatting, you may want to use $ to lock some references. For example, let we have the simple sheet as below:
First, select the range in the CORRECT order. This is important. the first cell you select will be reference for offsets of the conditional formatting. For this example, let's do it like this:
Now, let's go for the conditional formatting itself! Conditional Formatting > New Rule... > Use a formula to determine which cells to format. And let's put this formula:
=if($A1<=2;TRUE;FALSE)
Click OK and...
There we go! We just formatted the lines in witch An is equal or less than 2! Please note that we only had to lock the COLUMN of the reference. So, logically, to format the columns we would have locked the ROW.
Hope it helps!
EDIT:
If you REALLY want to use VLOOKUP, which I DO NOT recommend, you can just use the formula:
=(VLOOKUP($C25;$C$6:D$18;COLUMNS($C$6:D$18))+E25)>32
To change the index dinamically.

Choose function does't return 2 columns on Google Sheets

I am trying to find a value by multiple conditions by CHOOSE command. But I get an error
VLOOKUP evaluates to an out of bounds range
Code:
=VLOOKUP(A2&B2,CHOOSE({1,2},'Revalue Percentage'!$A$2:$A$100&'Revalue Percentage'!$B$2:$B$100,'Revalue Percentage'!$C$2:$C$100),2,0)
I tried to change 2 to 1 like this:
=VLOOKUP(A2&B2,CHOOSE({1,2},'Revalue Percentage'!$A$2:$A$100&'Revalue Percentage'!$B$2:$B$100,'Revalue Percentage'!$C$2:$C$100),1,0)
It will return the first column. So I think choose function returned once column instead of 2 columns. Please tell my why it said error. I think it's google sheets' problem.
Try this array formula¹,
=INDEX('Revalue Percentage'!$C$2:$C$100, MATCH(A2&B2, 'Revalue Percentage'!$A$2:$A$100&'Revalue Percentage'!$B$2:$B$100, 0))
¹ Array formulas need to be finalized with Ctrl+Shift+Enter↵. If entered correctly, Excel with wrap the formula in braces (e.g. { and }). You do not type the braces in yourself. Once entered into the first cell correctly, they can be filled or copied down or right just like any other formula. Try and reduce your full-column references to ranges more closely representing the extents of your actual data. Array formulas chew up calculation cycles logarithmically so it is good practise to narrow the referenced ranges to a minimum. See Guidelines and examples of array formulas for more information.

Excel how to SUMIF with multiple criterias in Range of Column

Above picture is just a simple Files that I created, My original file is complicated and has a range of numbers in Criteria field.
NOTE: I just want only one Formula to get final Answers, not many Formulas then sum again those lines. (Using EXCEL)
Thanks and appriciate
p/s: Sorry for my rip English
Your formula in the upper right is close. You can use:
=SUM(SUMIF(C3:C23,K5:K10,D3:D23))
However, this in an array formula, so you must confirm this formula with CTRL+SHIFT+ENTER for it to work properly
And if you don't want to have a range that contains your criteria, you can list it right in the formula like this:
=SUM(SUMIF(C3:C23,{20,22,24,25,26,28},D3:D23))
(Same thing - must confirm with CTRL+SHIFT+ENTER)

Excel Nesting IF in SumIfs

Ok. So i'm looking to nest IF in my SUMIFS formulas. The only problem i'm having is when one of my referenced cells show FALSE, the formula no longer works. How do i get the formula to completely remove that Criteria from the SUMIFS formula and still work?
Codes i've used.
=SUMIFS(R:R,IF(BE4=TRUE,I:I),IF(BE4=TRUE,BD4),J:J,BD5)
=IF(BE4=TRUE,SUMIFS(R:R,I:I,BD4),0)+IF(BE5=TRUE,SUMIFS(R:R,J:J,BD5),0)
I've even tried breaking the SUMIFS formula into multiple cells, and using IF and INDIRECT to create a working code. Just keeps popping up with #REF error.
Here's that code
=INDIRECT(CONCATENATE(BK1,IF(BE2=TRUE,BK2,""),IF(BE3=TRUE,BK3,""),IF(BE4=TRUE,BK4,""),IF(BE5=TRUE,BK5,""),BK6))
Here's the code that didn't work before the IF.
=INDIRECT(CONCATENATE(BK1,BK2,BK3,BK4,BK5,BK6))
Any help would be greatly appreciated.
Thank you
Mock Sheet
https://www.dropbox.com/s/tl64vbsalcqxqdm/CriteriaIFS.xlsx?dl=0
Try this formula:
=SUMIFS(BK1:BK6,BK1:BK6,">=0")
Please try this formula,
=IF(BE4=TRUE,SUMIFS(R:R,I:I,BD4,J:J,BD5),SUMIFS(R:R,J:J,BD5))
Your formula
=SUMIFS(R:R,IF(BE4=TRUE,I:I),IF(BE4=TRUE,BD4),J:J,BD5)
You are saying:
Sum from column R everything if match in J with BD5 and IF BE4 is TRUE THEN in I IF match with BD5. Well, the error is because, if BE4 is true is returning a string not a range. Instead you could use this:
=SUMIFS(R:R,INDIRECT(IF(BE4=TRUE,I:I)),INDIRECT(IF(BE4=TRUE,BD4)),J:J,BD5)
And it will be ok, until BE4 is FALSE. because the INDIRECT function return an #REF!... and will be a mess.
I'm not sure if I get the whole idea, but please tell me if you need an emprovement.
Edit #1
Reading your comments I think this could help:
=IF(BE4=TRUE,SUMIFS(R:R,I:I,BD4),0)+IF(BE4=TRUE,SUMIFS(R:R,J:J,BD5))
Try to post some dummie database (using text table format) to give you a better help... and remember to read this: How to ask because your question is to vague, and it was necesary to many comments and answers to "guess" what you really want.
Try this array formula:
=SUMIFS(N:N,IF($A$2,E:E,T:T),IF($A$2,$C$2,""),IF($A$3,F:F,T:T),IF($A$3,$C$3,""),IF($A$4,H:H,T:T),IF($A$4,$C$4,""),IF($A$5,I:I,T:T),IF($A$5,$C$5,""))
It is an array formula and must be confirmed with Ctrl-Shift-Enter.
This is based on your data sheet provided. You will need to change the references to your sheet. The column T reference should be a column that is empty.
I needed to do the same thing. The formula needed to look at a different column as Criteria_Range2 depending on product. I put an IF statement for both the Criteria_Range2, and for the Criteria2 because each column had slightly different information. Basically, it tells the formula use column C (in another worksheet) as the Criteria_Range2 if the product category is anything other than Ceilings. If it is Ceilings, it uses column A as Criteria_Range2. On my worksheet, Column A is a "helper column" that groups our Ceilings sub-products into Tile and Grid.
Hopefully this isn't too confusing, but it works for me and I didn't easily find anything else out there showing how to use IF statements in the Criteria Ranges in the SUMIFS. (I suggest ignoring the very ugly xlookup defining the sum_range.)
SUMIFS(XLOOKUP($AF$20&"COGS CM MTD",Fact_Sales!$E$6:$CS$6&Fact_Sales!$E$7:$CS$7,Fact_Sales!$E$8:$CS$928),Fact_Sales!$B$8:$B$928,'Report Draft'!$AE27,IF('Report Draft'!$AD27<>"CEILINGS",Fact_Sales!$C$8:$C$928,Fact_Sales!$A$8:$A$928),IF('Report Draft'!$AD27<>"CEILINGS",'Report Draft'!$AD27,'Report Draft'!$AF27))

Median Calculation in Excel with Conditions

I am having trouble getting the following Excel formula to work. I think I am having an issue with my parenthesis. I am trying to take the median based off of 3 conditions. The last condition is a date range.
=MEDIAN(IF($G$3:$G$458=$K$3,IF($A$3:$A$458=M$3,IF(AND($E$3:$E$458>DATEVALUE("1/1/2014"),$E$3:$E$458<DATEVALUE("12/31/2014")),$H$3:$H$458))))
Your formula is correct you just need to hit CTRL+SHIFT+ENTER to make it an array formula.
Whenever you apply a formula (E3:E458=$E$458) to a range within one cell you need to make the calculation an array formula.

Resources