Count multiple cell with multiple criteria - excel-formula

I want specific count of cell based on the specific criteria. I am currently using COUNTIF formula to get the result.
=COUNTIF(J:J,A4)+COUNTIF(G:G,B2)+COUNTIF(H:H,D2)+COUNTIF(I:I,B3)
The actual result should be 2 in cell B4.

Try this in B4 then fill right and down.
=COUNTIFS($J:$J, $A4, $I:$I, B$3, INDEX($G:$H, 0, INT(COLUMN(B:B)/2)), INDEX($B$2:$E$2,1,(INT((COLUMN(A:A)-1)/2)*2)+1))

Related

Google Sheets or Excel: setting the value of a remote cell from a formula

Is there a way to create a formula in one cell that will change the value in another cell based on some criteria, without scripting? Example: cell a1 contains a numerical value. cell b1 contains a value from a drop-down list, say, "YES,NO". If cell b1 is set to "YES" I want to remove (set to zero) the value in cell a1. What I'd like to do is have a formula in cell c1 that interrogates b1 and sets the value in a1 accordingly. Is the only way achieve this writing code and using setValue?
you cant remove it without a script. you can visually hide it in various ways. if the A1 is subject of further sum (as in your case per your comment) the sum formula can be always altered to reflect desired output. example:
if your formula is
=SUM(A1, C5, D22)
you can do
=SUM(IF(B1="YES", 0, A1), C5, D22)
Use the following on the cell you need the calculation (or zero) on:
=IF (B1="YES",0,SUM(A:A))
Using the given formula, you would do the SUM calculation for the whole Column A if the value on B1 is "YES", if not, then a 0 would be placed on the cell you put the formula on.

Excel: Count cells in range if they are equal to cell above

I'm just wanting to have a formula to count the amount of cells from E4:X4 if the number in each cell in that range is equal to the number in the cell directly above it. I was trying doing a COUNTIF with an INDIRECT ADDRESS for the cells above but didn't get anything so I was probably doing it quite wrong.
Just to be very clear for example if in that range cell E4 is 5 and above it (E3) is also 5 then to count it, and not count it if it isn't. Same for every cell down to X4.
Thanks.
You can use Sumproduct for that. In the screenshot, the formula in cell I2 is
=SUMPRODUCT(--(A1:G1=A2:G2))
To count only non-empty cells, you can change the formula to
=SUMPRODUCT(--(A1:G1=A2:G2),--(A2:G2<>""))

Sumif with mapping multiple the same rows

I want to write excel formula that will sumif the values based on a match of the rows. The problem is that I the cells to be matched can occur multiple times and basing on the Mapping legend they should return the sum of values.
In the yellow cells I am trying to caluclate sumif of values in range B9:B14. In formula I am using index to match the names and to return the sum of all that is assined to Item1, then Item2 and Item 3. Unfortunately, Index gives only the match with the first met not with the all that I have in mapping legend. Does Anybody has idea how to write this formula?
Here is the formula that I use (wrong) and in cell C4 and C5 is the result that should be achieved for Item 2 and Item 3:
:
Item 1 is ok because it does not have more than 1 mapping.
You can also use the following in B3 and drag down.
Enter as an array formula using Ctrl+Shift+Enter
=SUMPRODUCT(--($A$10:$A$15=IF($F$3:$F$8=$A3,$G$3:$G$8)),$B$10:$B$15)
This works because the arrays are of equal length and items appear in the same order.
You can easily accomplish this in two steps:
In H3 enter formula: =SUMIF($A$10:$B$15, G3, $B$10:$B$15). Drag it all the way down until 8th row.
In B3 enter formula: =SUMIF($F$3:$H$8, A3, $H$3:$H$8). Drag it all the way down until 5th row.
Your results should be like this:
its very simple no need to complicate with index functions.
First you need to cross ref the mapping legend with your inputs using sum-if function and then do that again to get individual values from each items.
Sumif in action
Sumif visualized
With refrence to the image put this formula in H3 to H8
=SUMIF($A$10:$A$15,G3,$B$10)
and then this formula in B3 to B5
=SUMIF($F$3:$F$8,A3,$H$3:$H$8)

How to input min/max values and have Excel generate cells for each number in the range

I have 2 cells A2 and A3, I will input a min value and max value respectively in each cell. Say 100 in A2 and 200 in A3.
I would like Excel to populate cells with values within that range. So Column B would have cells 1-101 filled in with 100,101,103,104,105....200.
Is there any easy way to do this or should I just stick to putting 100 in B1 and dragging it down?
In you first cell:
=IF(ROW(1:1)-1+$A$2<=$A$3,ROW(1:1)-1+$A$2,"")
Then drag/copy the cells down far enough to cover any combination you will have. You can fill the whole column if you want.
Microsoft is working on their Dynamic Arrays, Once released, a simple formula in the first cell of:
=SEQUENCE(A3-A2+1,,A2)
Will autmatically fill down the sequence without the need of dragging the formula down.

how do get number separately

I have number from 1 to 100 in column A1 to A100.
I am trying to achieve two results from data.
I want separately 1,2,3,4,5,6,7,8,9 and another one 10,20,30,40,50,60,70,80,90,100
Please help me
Maybe, in B1:
=1*(LEN(A1)=1)+2*(RIGHT(A1)="0")
double-click the fill handle and sort A:B on ColumnB.
This question is a bit vague. If you are looking to count by 10s, try adding a 10 in cell B1 and then adding the formula =B1+10 in cell B2. You can drag that formula down to count by 10s.
Let's say we want in column B "0, 1,2,3,4,5,6,7,8,9" and in column C "0, 10,20,30,40,50,60,70,80,90,100", put:
- =MOD(A1,10) as formula for the cell B1
- =INT(A1/10)*10 as formula for the cell C1
and then copy them to rest of the rows.

Resources