I'm using an array formula to calculate the second-largest value in each of Columns B-Z, conditional on the values being with a certain date range in Column A. Cells J2 and J3 contain the date ranges for IF function.
The formula I'm using is as follows:
{=LARGE(IF(($A$4:$A$4054>=$J$2)*($A$4:$A$4054<=$J$3),B4:B4054),2))}
In the majority of cases, the formula works perfectly but occasionally it is throwing up "0" as the answer - even though there's no zeroes in column D.
Is there an error with the formula? Or, alternatively, is there another formula I can use to achieve the same outcome?
Thanks in advance! :)
Related
I have an excel formula =SUM(AZ2:AZ300)
I want to make this more dynamic by using the formula =ROW(OFFSET($B$1,COUNTA($B:$B)-1,0)) in cell A1
Then I want my formula to do the following =SUM(AZ2:AZ&A1)
This formula doesn't work, but it to take the sum of cells AZ2 through AZ and the number given in cell A1
For example if A1 value is 250 then I want the formula to be equivalent to =SUM(AZ2:AZ250)
Thanks in advance for your help.
Rather than putting the row number in a separate cell you could combine it in the formula:
=SUM($A$2:INDEX($A:$A,COUNTA($B:$B)-1))
This does the same as the OFFSET version, with the bonus of not being volatile.
My SUMIFS formula criteria is based on a cell (say A1) that is data validated by list and changed via selection by user. If cell has data inside text or number by selection from drop down list, SUMIFS formula is considering that data as criteria to calculate the related sum. If criteria cell is left blank, I want formula to sum everything without any condition. My problem here; in criteria field of SUMIFS formula, I typed if condition like; SUMIFS(sum-range,criteria_range,IF(A1<>"",A1,"*")) but in this case excel considers only text values and do not include cells containing number. Briefly, if nothing selected in A1, I want SUMIFS formula to sum everything without any condition, numbers, texts and even blank cells. How can we proceed to do that?
EDIT:
Here an example for data and formula, what is expected is actually to disable criteria if one of selection is blank on left. Harun's suggestion works but if there is blank cell in criteria range, then in this case it won't consider those values in sum. For instance, if we select from left Phone/smart/touch, then how can we get "2" as output no matter what is in cri_range4 cells? Thanks
Example:
How about this solution? It basically ignores a missing entry in column C and evaluates only the other two. (Your example formula has a fourth criterium that isn't apparent in your list but the method can be extended for as many criteria as you might have.
=SUMPRODUCT((IF(LEN(C2),(INDEX(Lists,,1)=C2),TRUE))*(IF(LEN(C3),(INDEX(Lists,,2)=C3),TRUE))*(IF(LEN(C4),(INDEX(Lists,,3)=C4),TRUE))*SumRange)
For better readability I created a named range Lists which comprises your sample range E2:H10 while I named I2:I10 as SumRange'. INDEX(Lists,,1}` refers to the first column of the range. It's important that SumRange and Lists have the same number of rows.
If A1 is blank then just use not equal operator to sum all cells that are not blank. Try below.
=SUMIFS(D1:D5,C1:C5,IF(A1<>"",A1,"<>"))
Edit: can you check below formula in D3 cell then drag down.
=IF(C2="",SUM($I$2:$I$10),SUMPRODUCT(($E$2:$H$10=C2)*($I$2:$I$10)))
I have a formula that is finding the closest time match to a user entered time. The formula works great when the Time column does not have any blank cells, but the second it sees a blank cell, I get the #VALUE! error. How do I get this formula to exclude blank cells and only index/match existing data?
{=INDEX(B2:B5000,MATCH(MIN(ABS('User Input'!G8-B2:B5000)),ABS('User Input'!G8-B2:B5000),-1))}
Your lookup range cannot guarantee a sort, since you use the ABS() value of a data operation. The new XLookup() function which was just released to the Office 365 monthly channel can do a simpler formula that does not require any sorting.
=XLOOKUP(MIN(ABS(Sheet2!A1-B2:B10)),ABS(Sheet2!A1-B2:B10),B2:B10,,1)
If you can't use XLookup, you could use a helper column (e.g. in column C, with the formula =ABS('User Input'!$G$8-B2) , copy down and sort the data by that column. Then you can simplify the Index/Match to
=INDEX(C2:C5000,MATCH(MIN(C2:C5000),C2:C5000,-1))
Hi all, I have a problem with a formula with SUMIFS and INDIRECT.
I want to sum up the lines in the D column that does not have the "AL" in the B column.
The number of lines between the sum of the row where the formula is and D6 will increase and vary.
I get the error #VALUE!
The formula is:
=SUMIFS(D6:INDIRECT("R[-1]C";0);B6:INDIRECT("R[-1]C";0);"<>AL")
examples of my excel worksheet layout
The line above having the formula =SUM(D6:INDIRECT("R[-1]C",0)) works great
I think that the formula should work but it doesn't.
Anyone who can figure out what is wrong with the formula?
Thanks!
/martin
In the SUMIFS function, the criteria_range needs to be in a single column. In the INDIRECT function you are using an absolute start column with a relative end column which results in multiple columns. Need to use an absolute end column. For example, change...
=SUMIFS(D6:INDIRECT("R[-1]C";0);B6:INDIRECT("R[-1]C";0);"<>AL")
to...
=SUMIFS(D6:INDIRECT("R[-1]C";0);B6:INDIRECT("R[-1]C2";0);"<>AL")
SUMIFS(C1:C5,A1:A5-B1:B5,">5")
Is the above formula workable in excel?
Column A and Column B contain dates
Column C contains quantity.
What I need is When Column A minus Column B greater than 5 then sum all the quantity.
I understand this is able to do with creating a new column to get the difference in date first then use the computed value inside SUMIFS formula.
However, I really try to avoid adding an extra column.
Thank you
You can use the following formula:
=SUMPRODUCT(IF((A1:A5-B1:B5)>5,C1:C5))
this is an array formula, so press ctrl+shift+enter to calculate the formula.
Hope this works for you.