How to define excel SUMIFS criteria considering any text and numbers? - excel

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)))

Related

Data Validation Ignore Blanks of Range populated by Formula

I have a named range that I'm using to populate a drop-down list. The cells in this range are populated by pulling unique values from another much larger named range on the spreadsheet. When populating this drop-down list, I would like to ignore blank cells in the first named range. I've tried using OFFSET, such as the following:
=OFFSET(Sheet1!$F:$F,1,0,COUNTA(Sheet1!$F:$F)-1,1)
This isn't working, and I think it's because Excel doesn't consider the cells to actually be blank. The cell is instead filled with a formula and the formula is returning "". Is there any way you guys know of to ignore blank values returned by formulas in drop-down lists?
You have to use =ROWS(F:F)-COUNTBLANK(F:F) to skip over blank formula results. The whole formula shoudl be something like:
=OFFSET($E$1,
COUNTA($E:$E)-(ROWS($E:$E)-COUNTBLANK($E:$E)),
0,
ROWS($E:$E)-COUNTBLANK($E:$E))`.
Tested:

Adding the sum of best 5 of 7 cells

So I have tried to use sumproduct to pull data from cells. My issue is that I would prefer to pick 5 individual cells vs a bank of cells.
I can make this formula below work, but it pulls "Place" cell values into the equation as well as "Points" value cells
Image of cells and formula
I would like to use the formula
=SUMPRODUCT(Large(C5,G5,K5,O5,S5,W5,AA5,{1,2,3,4,5))
to pull only from the 7 specific cells, but I get an error. as soon as I enter large, it only has the first 3 cells highlighted.
The error states that You've entered too many arguments for this function.
I am new to the Large formula as well, but it can only accept an array, not individual cells. You did specify individual cells which would lead to the next argument.
Since the Large formula only excepts 2 arguments you have too many and it fails with an error.
It is not a nice solution, but I guess the formula could work if you put your specific individual cells in neighbouring cells to create the array needed for the formula. (Or at least refer to them in some other cells to create the Array)
For the result you also would need 5 cells to enter the Sumproduct formula to display in each cell the 5 individual results.
Similar to:
=SUMPRODUCT(Large(A1:A7,1))
Where A1:A7 would be the newly created array where you reference:
in Cell A1 =C5
in Cell A2 = G5
in Cell A3 = K5
etc.
The LARGE function expects a single contiguous range as its first argument.
This array formula should circumvent that restriction.
=SUM(LARGE(IF(MOD(COLUMN(C:AA), 4)=3, C5:AA5), ROW($1:$5)))

Filling down a VLOOKUP formula without changing the range

I am comparing values in a row in one sheet to values in another row in another sheet. The following formula and works:
=IFERROR(VLOOKUP(A1,Sheet1!A1:A19240,1,FALSE),"No Match")
My problem is when I fill down the formula, it increments A1 correctly but also increments the (A1:A19240), so half way down I have narrowed the search field.
How can I apply this formula to a column?
Change A1:A19240 to A$1:A$19240, i.e. apply:
=IFERROR(VLOOKUP(A1,Sheet1!A$1:A$19240,1,FALSE),"No Match")
This is called using absolute references.

Unique value in excel

I have an array of numbers in Excel spanning from Cells B1 to F49. Out of all those numbers I want to find out the unique values, in other words, no duplicates. I tried using Remove duplicates but it looks at the rows and not the individual cells. What would be my best option for doing this? any help would be greatly appreciated.
You could try this array formula that returns unique text or numbers from a rectangular range.
Select a range to output the results to eg: H1:H245
Copy and paste the formula below into the formula bar.
Press Ctrl+Shift+Enter to enter into the range.
=IFERROR(CELL("Contents",INDIRECT(T(IF(1,TEXT(MODE.MULT(IF(FREQUENCY(COUNTIF(B1:F49,"<="&B1:F49)+ISTEXT(B1:F49)*COUNT(B1:F49),COUNTIF(B1:F49,"<="&B1:F49)+ISTEXT(B1:F49)*COUNT(B1:F49))>={1,1},MODE.MULT(10^5*ROW(B1:F49)+COLUMN(B1:F49),10^5*ROW(B1:F49)+COLUMN(B1:F49)))),"r0c00000"))),0)),"")
I'd probably put this formula in column C: (or another empty column you have):
(so starting in cell C1: )
=COUNTIF(B:B,B1)=1
(and copy/paste the formula down)
It will return TRUE if it is unique. So you can then filter things out via Filter, or with other formulas down the road.
It may be easiest to just combine your information into one long column and run a remove duplicates. If this is not an option you may want to look at writing a macro to crawl through the records.
You could have a macro go through each column for the rows specified and determine if the CountIf function =COUNTIF(B2:F49,B2) returns a value >1
if it does there are at least 2 instances of this number.
I'm not sure how you want to identify your unique cells but you could potentially set a text color or return the values of the cell to another location.
Simplest for identification of values unique within the entire array may be to highlight the entire range with ‘standard’ formatting of choice for uniques, then select the entire range, Conditional Formatting, Highlight Cell Rules, Duplicate Values…, and choose a custom format of no fill and font of whatever you started with.

Advanced Excel: Sum of relative cells of a category

I’m a designer. I have a list of tasks, with hours, and I’ve split them into milestones. I want to count the number of hours for each milestone.
Here’s a picture:
In other words: I want to look at the value in the M column, if it’s 1, I want to get the cell across it, then repeat down the rows, and sum the whole lot.
See if you can figure that one out with the least cell wastage! :) (This is Numbers for Mac, so no macros or vbscript or what-have-you.)
In Excel the SUMIF formula can be used.
Assumption: In picture above, the 'Hours' label is in cell A1
The formula for 'Milestone 1' in cell E2 would be:
=SUMIF($C2:$C11,RIGHT(E1,1),$A2:$A11)
The syntax of the formula is:
=SUMIF(range, criteria, sum range)
The criteria is determined by using the last character in the 'Milestone' heading.

Resources