I have the following data in C4:D10 as input. Cell G4 has the formula =UNIQUE(C4:C10), Cell H4 has the formula =TEXTJOIN(", ",TRUE,IF($C$4:$C$10=G4,$D$4:$D$10,"")), and Cell H5 has =TEXTJOIN(", ",TRUE,IF($C$4:$C$10=G5,$D$4:$D$10,"")).
The values in H4 and H5 are what I need: they combine the texts for each category. However, I would prefer to write one array formula by TEXTJOIN and over G4#. I tried =TEXTJOIN(", ",TRUE,IF($C$4:$C$10=G4#,$D$4:$D$10,"")), it did not work well.
Does anyone know how to write such one formula over G4# to achieve the same values?
PS: formulas with LAMBDA and helper functions will still be appreciated if there is no other choice.
You could achieve this with the formula below:
=LET(data,FILTER(C:D,C:C<>""),
dataC1,INDEX(data,,1),
dataC2,INDEX(data,,2),
UdataC1,G4#,
v,UNIQUE(TRANSPOSE(IF(dataC1=TRANSPOSE(UdataC1),dataC2,"")),1),
seqrv,SEQUENCE(ROWS(v)),
sep,", ",
x,MMULT((LEN(v)+LEN(sep))*(v<>""),SIGN(SEQUENCE(COLUMNS(v))))-LEN(sep),
y,MMULT(--(TRANSPOSE(seqrv)<seqrv),x+LEN(sep)-1)+seqrv,
IFERROR(MID(TEXTJOIN(sep,1,v),y,x),""))
Or you can spill it all in one go using:
=LET(data,FILTER(C:D,C:C<>""),
dataC1,INDEX(data,,1),
dataC2,INDEX(data,,2),
UdataC1,UNIQUE(dataC1),
v,UNIQUE(TRANSPOSE(IF(dataC1=TRANSPOSE(UdataC1),dataC2,"")),1),
seqrv,SEQUENCE(ROWS(v)),
sep,", ",
x,MMULT((LEN(v)+LEN(sep))*(v<>""),SIGN(SEQUENCE(COLUMNS(v))))-LEN(sep),
y,MMULT(--(TRANSPOSE(seqrv)<seqrv),x+LEN(sep)-1)+seqrv,
join,IFERROR(MID(TEXTJOIN(sep,1,v),y,x),""),
CHOOSE({1,2},UdataC1,join))
with lots of help from this answer from Mark Fitzpatrick
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
Is there a way to calculate the count of items in a range, that are a formula?
I'm only expecting =TEXT formulas, so I tried =COUNTIF(1:1, "=TEXT"), but that didn't work. Seems CountIf only operates with the displayed values of the cells.
If I have understood your post clearly, specifically you need those functions which starts TEXT() then perhaps you could try :
• Formula used in cell F6
=SUM(N(IFERROR(LEFT(FORMULATEXT(D6:D19),6)="=TEXT(",0)))
If you have the following in cells A1:A5
=TEXT("493","DDD")
555
=TEXT("420000","YYYY")
Yep
Nope
Either of these formulas should give a result of 2
Counts formulas
=SUMPRODUCT(--ISFORMULA(A:A))
Counts Cells with Formula Text
=SUMPRODUCT(--ISNUMBER(SEARCH("text(",FORMULATEXT(A:A))))
HI i am trying to write the IF function like this.
=IF(AND(E3="Epyllion",J3="7"),".70","")
But result always shows 0 instead of .70.
My point for this function is,
IF E3="Epyllion" AND J3="7" Then .70 AND IF E3="Epyllion" AND J3="5" Then ".72" AND IF E3="Epyllion" AND J3="3" Then ".80"
Can someone help me to write this formula.
The following formula works for me.
IF(AND(E3="Epyllion",J3=7),70,IF(AND(E3="Epyllion",J3=5),72,IF(AND(E3="Epyllion",J3=3),80,"NULL")))
Try this formula in F2 cell
=IF(AND(E2="Epyllion",J2=9),".90",
IF(AND(E2="Epyllion",J2=7),".70",
IF(AND(E2="Epyllion",J2=5),".50",
IF(AND(E2="Epyllion",J2=3),".30",""))))
Your formula should have been
=IF(AND(E3="Epyllion",J3=7),".70","")
unless Cell J3 is formatted as text.
With all the conditions mentioned in the question formula can be written as
=IF(E3="Epyllion",IF(J3=7,".70",IF(J3=5,".72","0.8")))
provided you just have 7,3,5 for Cell J3. If you have more than these three values then use
=IF(E3="Epyllion",IF(J3=7,".70",IF(J3=5,".72",IF(J3=3,".80",""))),"")
I'm looking for a way to unpack an excel formula into a formula that depends only cells that don't refer to other cells.
Example: in the spreadsheet below, cell A1 contains the formula "B1 + B2". Meanwhile, cell B1 contains the formula "C1 + D1", while B2 contains the formula "C2 + D2". Cells C1, C2, D1 and D2 are all constants (in this case, the values 1, 2, 3 and 4).
What I want: I'm looking for a way (either already built into excel, or a user-defined function in VBA), that would function like this:
Call: =ExplodeFormula(A1)
Returns: "C1 + D1 + C2 + D2"
Any chance someone can help me out here? Thanks!
(Edit) A few things I think will be needed for this:
Some way to distinguish a cell reference in a formula from the functions used in that formula.
Some way to distinguish a range reference from a single cell reference (if a cell is referring to a range, like it would in the case of a vlookup, I'd be fine stopping at that level.
A way to iterate through the portions of the formula identified in parts 1 and 2 and break them down into simpler chunks that are recursively run through the same process.
You would have to build an Excel formula parser and apply it recursively to the formulas referred to by any references found in the original formula. And watch out for circular and repeated references!
There are a few formula parsers around, see for starters:
http://ewbi.blogs.com/develops/popular/excelformulaparsing.html
and as a matter of curiosity: why would you want to do this?
I need some help in writing a formula in excel with data from the cell H2 as 'x' and O2 as 'n' for the following equation.
x/1!+x^2/2!+x^3/3!+.....+x^n/n!
Is there a way to write a formula for this in excel and update a cell with resultant data?
Formula in C2 is
{=SUM($A2^ROW($A$1:INDEX($A:$A,$B2))/FACT(ROW($A$1:INDEX($A:$A,$B2))))}
This is an array formula. Put it into the cell without the curly brackets and then press [Ctrl]+[Shift]+[Enter] to finish.
Edit:
prepared for copying downwards
ROW($A$1:INDEX($A:$A,$B2)) = {1;2;3;...;n} with $B2 = n
i think you are trying to achieve this:
=(H2)/FACT(1)+(H2^2)/FACT(2)+(H2^3)/FACT(3)+....+(H2^O2)/FACT(O2)
hope it solves it.