Example: I need to count the number of values in a range that are greater than 3, but I don't want to have to rewrite the formula every time the criteria number may change. So the criteria number is calculated in a reference cell. So, lets say, 3 is entered in cell A2. A formula should be countif(C:C,>A2). Excel does not seem to like the greater than used with a reference cell. Is there a work around?
You need to use:
=COUNTIF(C:C,">"&A2)
Related
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 had a table in excel where prices of products are written in US Dollars. I want to change these cells to Euros and some markup so I had to multiply all these cells with a constant cell which contains something like this =0.86*1.03*1.15.
The problem is I had to keep initial US Dollar amount on the formula because I had to change this constant cell regularly due to currency and markup changes. So every time I change it, it has to multiply with the initial amount.
I tried to set multiply formula to each cell but there are too many to write it every cell the same formula. Is there any option to set a formula to apply all those cells where multiplies initial amount with the constant cell?
So, you should do something like this, assuming the constant is in cell A1 and the prices in cells A5 onwards.
In cell B5 enter:
=$A$1*A5
and drag down as far as needed.
Edit, based on comments: if the values are in an existing table, then the calculations could be performed in a helper column then copy / pastevalues back over the original prices...
My problem:
I have the below tables:
In my second table (tbl_analysis), I need to create a formula in the Sum column that will sum the salary of a certain person over a certain period. When the period changes, the formula needs to be recalculated.
My try:
I started off by using the formula:
=SUM(my_range)
By the range can't be hard-coded, so I decided to find the cell address of the corresponding month as you can see in the range D12:E15
Formula in the cell D12:
=CELL("address",INDEX($A$2:$M$8,MATCH(A12,$A$2:$A$8,0),MATCH(B12,$A$2:$M$2,0)))
So when I tried to insert the above formula inside of the SUM formula like this:
=SUM(CELL("address",INDEX($A$2:$M$8,MATCH(A12,$A$2:$A$8,0),MATCH(B12,$A$2:$M$2,0)))
: CELL("address",INDEX($A$2:$M$8,MATCH(A12,$A$2:$A$8,0),MATCH(C12,$A$2:$M$2,0))))
And then Excel is referecing the cell address itself and not the address inside of the formula.
Skip the Addresses and use this based on the months:
=SUM(INDEX(A:M,MATCH(A12,A:A,0),MATCH(B12,$2:$2,0)):INDEX(A:M,MATCH(A12,A:A,0),MATCH(C12,$2:$2,0)))
Scott Craner has the right solution for this scenario and it makes more sense here. However if you would absolutely need to get cell reference from a cell you would be able to do it using the following function:
INDIRECT(cell)
Usually this isn't necessary but it can be handy when you want to break up a long formula where you would need to find a row number for example.
INDIRECT("A" & B2)
Where B2 has the row number for a dynamic range or specific moving target row.
INDIRECT function documentation
Suppose I have a discontinuous range of cells from a single column in a SUM formula (ie., SUM(A1:A3, A5), is there formula I can use that will tell me that 4 cells are being used in that sum, or tell me the number of cells being used in a sum in general? I'd like to have the sum formula result and in the cell next to it the number of cells being used by the sum. I'd prefer an approach without using VBA if possible.
EDIT: I wasn't as specific as I should have been and for that I apologize. Using SUM(A1:A3,A5) again, let's say this formula exists in cell A7. Is there an Excel formula or function I can use to refer to cell A7 which yields the number of cells it's using in the sum? I know I can use the COUNT function to accomplish this, but I'm trying to make this dynamic so that the formula I'm looking for depends of the number of cells being summed and every time there is a change in the number of cells being summed, this other formula or function detects it automatically.
With a continuous range, you can get the total cell count (used cells and empty cells) with something like:
=COUNTA(A1:B9)+COUNTBLANK(A1:B9)
but =COUNTBLANK() won't support discontinuous ranges, so use:
=COUNTA(A1:A3, A5)+SUM(COUNTBLANK(INDIRECT({"A1:A3","A5"})))
(I know it is ugly.)
What is the simplest way to get the value of a cell in a column if the other cells in it's row contains specific values?
I mean without using array formula or adding additional columns to create combined values. Array formula may confuse my students at the moment. I could be wrong but I feel there must be a formula for this. Something like =GetValue(FromColumn,Condition1Range,Condition1,Condition2Range,Condition2)
Much like Countifs() but instead of counting, I want to get that value instead.
Example,
I want to get the date of a row who's year is 2015, week is 1, and day is 5.