in column C i have a text with "xxx has been deleted because... " or "xxx have been deleted because... " . I have 2 formulas:
=IF(C3<>"",IF(FIND("has been deleted",C3),LEFT(C3,FIND("has been deleted",C3)-1),"DDDD"),"AAAAAAA")
and
=IF(C5<>"",IF(FIND("have been deleted",C5),LEFT(C5,FIND("have been deleted",C5)-1),"DDDD"),"AAAAAAA")
I want to combine the two but it doesn't work. Here is what i have tried :
=IF(C4<>"",IF(FIND("have been deleted",C4),LEFT(C4,FIND("have been deleted",C4)-1),IF(FIND("has been deleted",C3),LEFT(C3,FIND("has been deleted",C3)-1),"DDDD")),"AAAAAAA")
=IF(C4<>"",IF(FIND("have been deleted",C4),LEFT(C4,FIND("have been deleted",C4)-1),LEFT(C3,FIND("has been deleted",C3)-1)),"AAAAAAA")
formula:
=IF(C1="", "AAAAAAA",
IF( AND( ISERROR( FIND("has been deleted",C1)),
ISERROR( FIND("have been deleted",C1))),
"DDDD",
LEFT(C1, IFERROR( FIND("has been deleted",C1),
FIND("have been deleted",C1)) -1))
)
and here is my test based on the sample you described:
please note formula needs pasting into D1 and dragged down. as in picture
=IF(C1="","AAAAAA",IF(OR(ISERROR(FIND("have been deleted",C1)),ISERROR(FIND("have been deleted",C1))),IF(ISNUMBER(FIND("has been deleted",C1)),LEFT(C1,FIND("has been deleted",C1)-1),IF(ISNUMBER(FIND("have been deleted",C1)),LEFT(C1,FIND("have been deleted",C1)-1),"DDDDD"))))
Please enter this formula into D1 and it will show result based on value C1.
I hope we understood your question properly.
Related
In column A, starting with A1, I have a set of database column names which are Pascale case and without spaces. I'd like to use an Excel formula in column B to insert spaces before each Capital letter or number. Ideally any consecutive capital letters or numbers would remain together. I've done this in the past with C#, but on this project, I can't even use VBA macros. Example output:
Can this, or something close, be achieved using only formulas?
This is pretty hard, but with ms365 doable with the give sample data:
Formula in B1:
=MAP(A1:A10,LAMBDA(v,TRIM(REDUCE(v,SEQUENCE(LEN(v),,LEN(v),-1),LAMBDA(a,b,LET(x,MAKEARRAY(26,3,LAMBDA(r,c,CHOOSE(c,CHAR(r+64),CHAR(r+96),r-0))),y,MID(a,b,1),z,MID(a,b+1,1),r,BYCOL(x,LAMBDA(c,SUM(EXACT(c,y)+EXACT(c,z)))),IF(MAX(r)=1,LEFT(a,b-1)&IF((CONCAT(r)="110")*(EXACT(UPPER(y),y))," "&y,y&" ")&RIGHT(a,LEN(a)-b),a)))))))
Maybe others have shorter solutions...
Just for fun, this uses a single Reduce but I have defined some auxiliary functions. I put them in a module called 'is' in the Advanced Formula Environment so their full names are Is.Upper, Is.Lower and Is.Digit:
Upper=lambda(c,if(c="",false,and(code(c)>64,code(c)<91)));
Digit=lambda(c,if(c="",false,and(code(c)>47,code(c)<58)));
Lower=lambda(c,if(c="",false,and(code(c)>96,code(c<123))))
=REDUCE(LEFT(A1,1),SEQUENCE(1,LEN(A1)-1,2),LAMBDA(a,c,a&IF(OR(AND(is.Digit(MID(A1,c,1)),NOT(is.Digit(MID(A1,c-1,1)))),AND(is.Upper(MID(A1,c,1)),OR(NOT(is.Upper(MID(A1,c-1,1))),is.Lower(MID(A1,c+1,1)))))," ","")&MID(A1,c,1)))
This is how the main formula looks in the Advanced Formula Environment:
=REDUCE(
LEFT(A2, 1),
SEQUENCE(1, LEN(A2) - 1, 2),
LAMBDA(a, c,
a &
IF(
OR(
AND(
is.Digit(MID(A2, c, 1)),
NOT(is.Digit(MID(A2, c - 1, 1)))
),
AND(
is.Upper(MID(A2, c, 1)),
OR(
NOT(is.Upper(MID(A2, c - 1, 1))),
is.Lower(MID(A2, c + 1, 1))
)
)
),
" ",
""
) & MID(A2, c, 1)
)
)
Note - assumes string length>1.
This question already has answers here:
How to add multiple links in excel cell?
(2 answers)
Closed 1 year ago.
TLDR:
Unknown error appears if you have a formula constructed like this:
IFNA(Link1;Link2)
However, below example works which is basically the same thing,
A1: Link1
A2: IFNA(A1;Link2)
Edit: Formula in URLTEXT when IFNA function contains two LINK functions might be the culprit.
Any ideas why this might be?
Hi,
i am trying to make a dynamic link on cell C1. From a search string it looks through column A to find the search string on cell A1. I have added an IFNA function that checks if entery is missing in column A. If this happens then it looks for the search string A1 again but in column B.
The problem and unknown error,
when it matches with a string on column B then the dymanic link throws an error:
(Rough translation from swedish)
"file:///(long path)/ABCD%3F" is not an absolut URL that can be sent to an external program be opened."
However, each dynamic link works seperatly. It is when i combine them with the IFNA that this problem occur.
It seems like the constructed link is equal to the URLTEXT from the first lookup when it is supposed to be the row number from the second lookup.
I suspect this is the reason the link fails. I might be wrong though and i cant see why this would happen.
When breaking down the components into smaller parts all looks good:
Picture showing the setup and component breakdown
Picture showing formulas
Below is the setup for replicating this issue. Formulas and their belonging cells:
A1 = "ABC"
A3 = "acol"
A4 = "AB"
A5 = "CD"
B3 = "bcol"
B3 = "ABCD"
B4 = "CDEF"
C3 = "acode"
D3 = "bcode"
Renamed cells:
lookup_search_cell = A1
lookup_code_arr = A4:D5
translated_lookup_search_cell = B1
lookup_acode_col = C4:C5
lookup_bcode_col = D4:D5
B1:
=CONCATENATE(,
IF(CODE(MID(UPPER(A1),1,1))=0,CODE(MID(UPPER(A1),1,1))),
IF(CODE(MID(UPPER(A1),2,1))=0,CODE(MID(UPPER(A1),2,1))),
IF(CODE(MID(UPPER(A1),3,1))=0,CODE(MID(UPPER(A1),3,1))),
IF(CODE(MID(UPPER(A1),4,1))=0,CODE(MID(UPPER(A1),4,1))))
C1:
=IF(lookup_search_cell="","Enter🔎",
IFNA(
IFNA(
LINK("#sheet1.$A$" &
MATCH(translated_lookup_search_cell&"*",lookup_acode_col,0)+3 & ":" & "$B$" &
MATCH(translated_lookup_search_cell&"*",lookup_acode_col,0)+3,
IFERROR(
INDEX(lookup_code_arr,
MATCH(translated_lookup_search_cell&"*",lookup_acode_col,0),1
)&"?","Cant find acol entery"
)
),
LINK("#sheet1.$A$"&
MATCH(translated_lookup_search_cell&"*",lookup_bcode_col,0)+3 & ":" & "$B$" &
MATCH(translated_lookup_search_cell&"*",lookup_bcode_col,0)+3,
IFERROR(
INDEX(lookup_code_arr,
MATCH(translated_lookup_search_cell&"*",lookup_bcode_col,0),2
)&"?","Cant find bcol entery"
)
)
),"Cant find entery"
)
)
C4:
=CONCATENATE(,
IF(CODE(MID(UPPER(A4),1,1))=0,CODE(MID(UPPER(A4),1,1))),
IF(CODE(MID(UPPER(A4),2,1))=0,CODE(MID(UPPER(A4),2,1))),
IF(CODE(MID(UPPER(A4),3,1))=0,CODE(MID(UPPER(A4),3,1))),
IF(CODE(MID(UPPER(A4),4,1))=0,CODE(MID(UPPER(A4),4,1))))
C5:
=CONCATENATE(,
IF(CODE(MID(UPPER(A5),1,1))=0,CODE(MID(UPPER(A5),1,1))),
IF(CODE(MID(UPPER(A5),2,1))=0,CODE(MID(UPPER(A5),2,1))),
IF(CODE(MID(UPPER(A5),3,1))=0,CODE(MID(UPPER(A5),3,1))),
IF(CODE(MID(UPPER(A5),4,1))=0,CODE(MID(UPPER(A5),4,1))))
D4:
=CONCATENATE(,
IF(CODE(MID(UPPER(B4),1,1))=0,CODE(MID(UPPER(B4),1,1))),
IF(CODE(MID(UPPER(B4),2,1))=0,CODE(MID(UPPER(B4),2,1))),
IF(CODE(MID(UPPER(B4),3,1))=0,CODE(MID(UPPER(B4),3,1))),
IF(CODE(MID(UPPER(B4),4,1))=0,CODE(MID(UPPER(B4),4,1))))
D5:
=CONCATENATE(,
IF(CODE(MID(UPPER(B5),1,1))=0,CODE(MID(UPPER(B5),1,1))),
IF(CODE(MID(UPPER(B5),2,1))=0,CODE(MID(UPPER(B5),2,1))),
IF(CODE(MID(UPPER(B5),3,1))=0,CODE(MID(UPPER(B5),3,1))),
IF(CODE(MID(UPPER(B5),4,1))=0,CODE(MID(UPPER(B5),4,1))))
Sorry, i think this was a repost, found answer here.
How to add multiple links in excel cell?
This question can be deleted. If true then thanks to Didier for the information.
Here is another solution instead if anyone find it interesting,
=OM(lookup_search_cell=""
;
"Enter🔎"
;
LÄNK("#sheet1.$A$"&
OMSAKNAS(
PASSA(translated_lookup_search_cell&"*";lookup_acode_col;0)+3&":"&"$B$"&
PASSA(translated_lookup_search_cell&"*";lookup_acode_col;0)+3
;
PASSA(translated_lookup_search_cell&"*";lookup_bcode_col;0)+3&":"&"$B$"&
PASSA(translated_lookup_search_cell&"*";lookup_bcode_col;0)+3
)
;
OMSAKNAS(
INDEX(lookup_code_arr;
PASSA(translated_lookup_search_cell&"*";lookup_acode_col;0);1
)&"?"
;
INDEX(lookup_code_arr;
PASSA(translated_lookup_search_cell&"*";lookup_bcode_col;0);2
)&"?"
)
)
)
Conclution, you cant have multiple links in the same cell but you can mold the one and only link to what you want it to be.
I have one list starting from B1 (=UNIQUE(A1:A8)), and another list starting from D1 (=UNIQUE(C1:C8)). Thus =B1# and =D1# in other cells both spill.
Now, I would like to know if we could find one formula to combine List B1# and List D1# (extract only unique values) by dynamic array functions, LAMBDA, LET, etc.
I don't want to move the position of the two lists. Does anyone have any good idea?
I may not be following what you want the shape to be, but here are two shapes:
Side-by-Side
=CHOOSE({1,2},B1#,D1#)
If you want it to take the original A and C columns as input and do all the work, then:
=CHOOSE({1,2},UNIQUE(FILTER(A:A,NOT(ISBLANK(A:A)))),UNIQUE(FILTER(C:C,NOT(ISBLANK(C:C)))))
or a LET version of the same which does not require retyping the inputs:
=LET( Ltrs, A:A,
Nmbrs, C:C,
CHOOSE( {1,2},
UNIQUE(FILTER(Ltrs,NOT(ISBLANK(Ltrs)))),
UNIQUE(FILTER(Nmbrs,NOT(ISBLANK(Nmbrs)))) ) )
End-on-End
=LET( uLtrs, B1#,
uNmbrs, D1#,
ltrCt, ROWS(uLtrs),
idx, SEQUENCE( ltrCt + ROWS(uNmbrs) ),
IF( idx <= ltrCt, uLtrs, INDEX( uNmbrs, idx-ltrCt ) ) )
Similar as above, if you want it to take the original A and C columns as input and do all the work, then:
=LET( Ltrs, A:A,
Nmbrs, C:C,
uLtrs, UNIQUE(FILTER(Ltrs,NOT(ISBLANK(Ltrs)))),
uNmbrs, UNIQUE(FILTER(Nmbrs,NOT(ISBLANK(Nmbrs)))),
ltrCt, ROWS(uLtrs),
idx, SEQUENCE( ltrCt + ROWS(uNmbrs) ),
IF( idx <= ltrCt, uLtrs, INDEX( uNmbrs, idx-ltrCt ) ) )
Both spill the results.
Place the following code into cell F2 and drag formula downwards to F14. This will give you a unique list of both Column A and Column D
=IF(IFERROR(IF(INDEX($A$1:$A$99999,MATCH(0,COUNTIF($F$1:F1,$A$1:$A$99999),0))=0,NA(),INDEX($A$1:$A$99999,MATCH(0,COUNTIF($F$1:F1,$A$1:$A$99999),0))),INDEX($C$1:$C$99999,MATCH(0,COUNTIF($F$1:F1,$C$1:$C$99999),0)))=0,NA(),IFERROR(IF(INDEX($A$1:$A$99999,MATCH(0,COUNTIF($F$1:F1,$A$1:$A$99999),0))=0,NA(),INDEX($A$1:$A$99999,MATCH(0,COUNTIF($F$1:F1,$A$1:$A$99999),0))),INDEX($C$1:$C$99999,MATCH(0,COUNTIF($F$1:F1,$C$1:$C$99999),0))))
Let me know if you need it to behave differently.
I have been trying to make this work in cell I1:
=IF(B18="","",IF(AND(OR(C16=7,C16="J",C16=8),B18< 300,D16< DATE(2021,5,15),300,IF(B18< 350),350,B18),(IF(AND(OR(C16=4,C16="T"),B18< 500),500,B18))))
Where:
if C16 is 7 or J or 8
and
the date in D16< DATE(2021,5,15)
and
B18<300
Result in I1=300 otherwise B18 (in case B18 is over 300).
Otherwise if D16> DATE(2021,5,15) and B18<350 I1=350.
If B18>350, I1=B18
Sorry...it looks messy!
R
It seems like your formula and code don't align with each other.
But however, with the explanation you have provided, I could only write the following formula. Hope it works for you.
=IF( B18="" , "" , IF( AND( OR(C16=7,C16="J",C16=8), D16<DATE(2021,5,15) ) , IF(B18<300, 300, B18), IF( D16>DATE(2021,5,15) , IF(B18<350, 350, B18) ) ) )
I think I solved it like this:
=IF(B18="","",IF(AND(OR(C16=4,C16="T"),B18<500),500,IF(AND(OR(C16=7,C16="J",C16=8),B18<300,D16<DATE(2021,5,15)),300,IF(B18<350,350,B18))))
I am trying to write a formula to include multiple criteria and can't seem to get it right.
The formula works as is however I need to include "SHOT10","SHOT20", "SH15" and "SH20"
=IF(AND(C5194="SHOT15",H5194="",I5194=""),E5194,"")
Can someone assist me with modifying the above formula?
The AND(C5194="SHOT15",H5194="",I5194="") is equivalent to saying:
C5194="SHOT15" And H5194="" And 15194=""
So what you have in VBA code is:
If C5194="SHOT15" And H5194="" And 15194="" Then
ActiveCell = E5194
Else
ActiveCell = ""
End
You can use AND( and OR( to specify different parameters.
For example, If I want to pickup 3 different values in 'A1', but make sure that 'B1' and 'C1' are blank, I can use:
=IF(AND(OR(A1="A",A1="B",A1="C"),B1="",C1=""),"True","False")
So in your case specifically:
The issue now is that I now need to also consider SHOT10, SHOT20, SH15 and SH20 as well. Meaning that if either SHOT15, SHOT10, SHOT20, SH15 or SH20 appears in C5194 and H5194 is blank and I5194 is also blank then return the value of E5194 else return blank. The key is that all the conditions must be met for the value of E5194 be returned
Your formula becomes:
=IF(AND(OR(C5194="SHOT15",C5194="SHOT10",C5194="SHOT20",C5194="SH15",C5194="SH20"),H5194="",I5194=""),E5194,"")
Edit: Shorten Using an array constant per barry houdini:
=IF(AND(OR(C5194={"SHOT15","SHOT10","SHOT20","SH15","SH20"}),H5194="",I5194=""),E5194,"")
=IF(
AND(
OR( C5194="SHOT10", C5194="SHOT15", C5194="SHOT20", C5194="SH15", C5194="SH20" ),
H5194="",
I5194=""
),
E5194,
""
)