excel question with specific need
The description above describes my issue:
The formula
=COUNTIFS(GamesOUT!$D$2:$D$4377,$A2,GamesOUT!$G$2:$G$4377,">0",GamesOUT!$A$2:$A$4377,">20089999",GamesOUT!$A$2:$A$4377,"<20099999")
Needs:
In the above excel formula I want to replace the number “4377” with the value in cell B2.
Also I want to replace the number 20089999 with a formula calculating:
(value in cell A2)*10000+9999
Also I want to replace the number 20099999 with a formula calculating:
[(value in cell A2)+1)]*10000+9999
I cannot quite find a solution. A few stackoverflow posts dealt with this issue but the quotes within quotes in concatenate throw me for an "endless loop"
Use string concatenation to compose your criteria parameters inside COUNTIFS:
=COUNTIFS(GamesOUT!$D$2:$D$4377, $A2,
GamesOUT!$G$2:$G$4377, ">0",
GamesOUT!$A$2:$A$4377, ">" & (A2*10000+9999),
GamesOUT!$A$2:$A$4377, "<" & ((A2+1)*10000+9999))
What remains is to make your ranges extend dynamically until the row indicated by cell B2, you can use either INDIRECT, OFFSET or INDEX. The latter is preferred for being non-volatile: formula will recalculate only when its sources change. So you need to do some replacements:
GamesOUT!$D$2:$D$4377 ---> GamesOUT!$D$2:INDEX(GamesOUT!$D:$D, B2)
and similar for all the range parameters (that were "statically" ended by 4377). It will be a pretty big formula but it will work.
=COUNTIFS(GamesOUT!$D$2:INDEX(GamesOUT!$D:$D, B2), $A2,
GamesOUT!$G$2:INDEX(GamesOUT!$G:$G, B2), ">0",
GamesOUT!$A$2:INDEX(GamesOUT!$A:$A, B2), ">" & (A2*10000+9999),
GamesOUT!$A$2:INDEX(GamesOUT!$A:$A, B2), "<" & ((A2+1)*10000+9999))
Related
This question is linked to Formula to remove every middle name in a cell in Excel.
I basically want to make an if else statement in excel. So the IFchecks if the cell is equal to "Gian" OR"Pier", if the condition is confirmed the formula proceeds to use this other formula
=IFERROR(LEFT(A2,FIND(" ",A2)-1),A2)
Sorry guys idk how to do it in an excel way. I can show you in for example in a Java or C way.
if(A2=="Pier" || A2=="Gian")
=IFERROR(LEFT(A2,FIND(" ",A2)-1),A2) \\the excel formula that deletes every second/third name if the cell
if formula in excel that checks a condition and if its verified it proceeds to use another excel formula
You could try the following as per your Excel Versions
• Formula used in cell B2
=IF(OR(TEXTBEFORE(A2&" "," ")={"Pier","Gian"}),A2,TEXTBEFORE(A2&" "," "))
Or, in cell C2
=IF(OR(LEFT(A2&" ",FIND(" ",A2&" ")-1)={"Pier","Gian"}),A2,LEFT(A2&" ",FIND(" ",A2&" ")-1))
Just adding the use of LET() which makes it simpler,
• Formula used in cell B2
=LET(x,TEXTBEFORE(A2&" "," "),IF(OR(x={"Pier","Gian"}),A2,x))
Or, Formula used in cell C2
=LET(x,LEFT(A2&" ",FIND(" ",A2&" ")-1),IF(OR(x={"Pier","Gian"}),A2,x))
Using MAP() to Spill as one dynamic array formula but the logic remains same.
• Formula used in cell D2
=MAP(A2:A6,LAMBDA(m,
LET(x,TEXTBEFORE(m&" "," "),
IF(OR(x={"Pier","Gian"}),m,x))))
you have to use the AND(...) and OR(..) for chaining logical conditions.
Here's an example
I've run into a strange issue.
When checking a criteria range against "<>", this does not seem to capture cells that contain formulas which output nothing.
For example, if a cell has the formula ="", then the "<>" criteria recognizes the cell contains a formula. So even though the string value is nothing, it's counted anyway.
The desired result for "<>" on the above example would be 0, but since the cell contains a formula (=""), the value for that row is counted.
Is there a criteria alternative to "<>" which can capture non-blanks, even if it's the result of a formula?
I know I could take a sum, and subtract the result of SUMIFS(A2:A3, C2:C3, ""). However in practice I'm writing extremely complex formulas (multiple lines for a single formula), so to apply this method would be to double the size of my already huge formulas, and throw readability out the window. It would be much simpler if I could simply add a functional criteria to my existing sumifs formula.
You could use a SUMPRODUCT:
=SUMPRODUCT(A2:A3,LEN(B2:B3)>0)
I just figured out a solution;
Instead of having the formula in the criteria range output nothing, have it output a single space:
=" "
Then, you can have the sumifs search against " " and "<> "
I have a formula like below
=SUM(SUMIFS('Sheet1'!$AK:$AK,'Sheet1'!$AL:$AL,"<=0",'Sheet1'!$N:$N,C2))
I want the C2 to be a dynamic multiple criteria OR field which might range from 1 to 4 criteria.
If it would have been static the formula would be something like below
=SUM(SUMIFS('Sheet1'!$AK:$AK,'Sheet1'!$AL:$AL,"<=0",'Sheet1'!$N:$N,{"262","261","200"}))
How do I do it ? I can't get it to work with {"262","261","200"} as value in C2.
The below doesn't work either after having different values in C2,C3,C4
=SUM(SUMIFS('Sheet1'!$AK:$AK,'Sheet1'!$AL:$AL,"<=0",'Sheet1'!$N:$N,{C2,C3,C4}))
Try the following:
=SUM(SUMIFS(Sheet1!$AK:$AK,Sheet1!$AL:$AL,"<=0",Sheet1!$N:$N,FILTERXML("<t><s>" & SUBSTITUTE(C2, ",", "</s><s>") & "</s></t>", "//s")))
Credit to Vafā Sarmast for splitting to array technique.
It seems, from using evaluate formula, that the numbers end up being enclosed in <s> tags, which are then used via xpath of //s, to return all matching items as a list i.e. the numbers as an array. To insert the tags substitute is used on the existing delimiter along with concatenation (& "</s></t>"). At least, that is my understanding.
Enter with Ctrl + Shift + Enter as array formula.
Values go in as comma separated in C2
Info:
FILTERXML
Try the following formula. SUMIFS() supports multiple criteria so you can user C2, C3, C4 as criteria.
=SUM(SUMIFS(Sheet1!$AK:$AK,Sheet1!$AL:$AL,"<=0",Sheet1!$N:$N,C2,Sheet1!$N:$N,C3,Sheet1!$N:$N,C4))
What I am trying to do is concatenate two cells, then check that concatenated value against a column of values, and put an X in a cell if such a value exists. The following equation is what I'm using:
{=IF(CONCATENATE(A2, " ", B2) = 'MasterList'!$C:$C, "x", "")}
Column A is the name of the software and Column B the version number (A="Microsoft .NET Framework 4.5.1", B="4.5.50938", for example). I know that this concatenated value exists on the MasterList worksheet so I don't understand why I'm not getting the answer I expect.
Gurus, what's my flaw here?
The fastest comparison/lookup on the worksheet is a MATCH function. If you have a long column to put this formula into you could try,
=IF(ISNUMBER(MATCH(CONCATENATE(A2, " ", B2), 'MasterList'!$C:$C, 0)), "x", "")
Fill down as necessary.
It seams that you select the entire column C on yout MasterListSheet. Don't you mean just one cell? Like:
=IF(CONCATENATE(A2, " ", B2) = 'MasterList'!$C1, "x", "")
or try to : =IF(CONCATENATE(A2, " ", B2) = MasterList.!$C1, "x", "") (on open Office)
Best thing is instead of you write the Sheet name, let Excel do it for you by editing the formula, remove the sheet name and then with a mouse click navigate to the desired area.
I just want to say that before seeing this question, I had no idea what array formulas were.
I have the following working example:
Sheet1:
A1: Microsoft .NET Framework 4.5.1
B1: 4.5.50938
// press control-shift-enter after typing formula
C4: =IF(CONCATENATE(A1," ",B1)=Sheet2!$A:$A,"YAY","NAY")
Sheet2:
A1: Microsoft .NET Framework 4.5.1 4.5.50938
Not sure what the issue is with your spreadsheet. Do the values in MasterList!$C:$C actually correspond to what you expect as the result of the concatenation?
This is not a valid array formula. The LHS is a single cell while the RHS is an array. What it actually does is compare the concatenation to all cells of columns C in MasterList.
You either need to make it a valid array formula or a normal formula. I recommend the second solution.
For the first solution, it should be:
{=IF(CONCATENATE(A:A, " ",B:B ) ='MasterList'!$C:$C, "x", "")}
However, this will be very slow because it will compute and concatenate two full columns, and moreover you will have to select your whole range where you want to calculate it (a full columns) then press Ctrl+Shift+Enter.
You can make it a simple formula in on cell then copy/paste along your column. Formula for C2:
=IF(CONCATENATE(A2, " ", B2) = 'MasterList'!$C2, "x", "")
I have a list in excel that contain location but some cell have multiple locations separated by " _ " character for Example "_ Location1 _ Location 2" When there are only 1 location I can use Sumif to search for string and add the numbers next to the cell as shown here
My problem is not searching for a string but searching for a character in a list and finding how many there are in the cell it find I was going to add the formula in a different cell then the ones shown above
example formula NOT REAL
=sum(Sumif($A$4:$A$250,"* ~ Location1*",$C$4:$C$250)/Search($A$4:$A$250," ~ "))
I know search does work like this but as an example code this is what I imagine
to find the sum of each location use this array formula:
=SUMPRODUCT((ISNUMBER(SEARCH(D4,$A$4:$A$9)))*($C$4:$C$9/(IF(ISNUMBER(FIND("_",$A$4:$A$9)),LEN($A$4:$A$9)-LEN(SUBSTITUTE($A$4:$A$9,"_","")),1))))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter. If done correctly then Excel will put {} around the formula.
Enter the formula in E4, Hit Ctrl-Shift-Enter, then copy/fill down.
Then to get the total for all simply sum the rows above.
To do it with regular formulas:
You will need a helper column with the following formula:
=C4/(IF(ISNUMBER(FIND("_",A4)),LEN(A4)-LEN(SUBSTITUTE(A4,"_","")),1))
I put mine in Column G.
Then we can use a simple SUMIF():
=SUMIF(A:A,"*" & D4 & "*",G:G)