I need to format a certain column in excel such that:
Format is something like
hel 02/03
the cell must have three character string followed by space, followed by mm/dd.
How must my format look like?
instead to use a format you can create a concatenate column whit a formula that combine the two column :
=concatenate(C3;" ";text(D3;"mm/gg"))
where C3 contains Hel and d3 02/03. If the value is in the same cell i have to see how is formatted now on your sheet to suggest a different use of this formula.
Related
I have a typical book index in a spreadsheet that goes like this:
I need Excel to recognize the different integers in the same cell and add a constant each one of them.
Let's say the constant is 5
The result should be like this:
I couldn't get excel to recognize the different values in a cell.
My two cents, assuming Excel ms365:
Formula in B1:
=BYROW(A1:A3,LAMBDA(a,LET(X,TEXTSPLIT(a,", "),TEXTJOIN(", ",,IFERROR(X+C1,X)))))
Or, if no access to TEXTSPLIT(), then use:
=BYROW(A1:A3,LAMBDA(a,LET(X,FILTERXML("<t><s>"&SUBSTITUTE(a,",","</s><s>")&"</s></t>","//s"),TEXTJOIN(", ",,IFERROR(X+C1,X)))))
Or, if no access to BYROW(), you'd have to drag the following:
=LET(X,FILTERXML("<t><s>"&SUBSTITUTE(A1,",","</s><s>")&"</s></t>","//s"),TEXTJOIN(", ",,IFERROR(X+C$1,X)))
Not sure if this could be done smoothly and without using long and complex formulas.
Why don't you try to split the cell into multiple columns (Data > Data Tools > Text To Columns > Delimited and select Comma as delimiter). Once you have all different values is separate columns, it would be easy to apply formulas and add the constant.
After that, you could use CONCATENATE formula to merge texts and numbers back to single value in a single column.
Hope this helps.
I would separate the text and each value into separate cells, then use & to combine into the format you want, something like so:
=A1&", "&B1+G1&", "&C1+G1&", "&D1+G1
where A1 contains "Trauma" and B1 contains 15, C1 contains 17 and D1 contains 25. G1 holds the constant 5.
See
This is what I have tried,
Formula Applicable To Only O365 Beta Channel (Insiders).
• Formula used in cell B1
=TEXTJOIN(", ",,TEXTBEFORE(A1,", ",1),TEXTSPLIT(TEXTAFTER(A1,", ",1),", ")+5)
Or, if you are not using the above Excel Version, but using either Excel 2019, 2021 or Regular O365, then,
• Formula used in cell B1
=TEXTJOIN(", ",,LEFT(A1,FIND(",",A1)-1),IFERROR(
FILTERXML("<a><b>"&SUBSTITUTE(A1,", ","</b><b>")&"</b></a>","//b")+5,""))
Edit
One improvised approach:
=TEXTJOIN(", ",,TEXTBEFORE(A1,", ",1),IFERROR(TEXTSPLIT(A1,", ")+5,""))
You can also accomplish this task quite easily with Power Query.
I have in a cell two numbers "=5+4" as a text. This is a result of another operation.
I took a part of another formula and concatenated it with "equal" symbol:
= "=" & RIGHT(FORMULATEXT(V8);LEN(FORMULATEXT(V8))-SEARCH("+"; FORMULATEXT(V8)))
I want to get the result of 5+4 in a cell- which means "9" ;)
I DO NOT WANT TO USE VBA code.
my initial problem was to extract all numbers except the first one from an equation and sum in another cell: A1: "=6+5+4". A2: "9". Maybe it can be solved without VBA?
You could try (assuming only addition):
Formula in B1:
=SUM(FILTERXML("<t><s>"&SUBSTITUTE(MID(A1,2,LEN(A1)),"+","</s><s>")&"</s></t>","//s[position()>1]"))
In fact, if you don't want to use the 1st number we could also discard taking '=' into account:
=SUM(FILTERXML("<t><s>"&SUBSTITUTE(A1,"+","</s><s>")&"</s></t>","//s[position()>1]"))
And since SUM() will ignore text in the final answer, we can now even further simplify this (thanks #JosWoolley):
=SUM(FILTERXML("<t><s>"&SUBSTITUTE(A1,"+","</s><s>")&"</s></t>","//s"))
If you are always adding 2 numbers, then you can use this:
=VALUE(VALUE(MID(A1;2;SEARCH("+";A1)-2))+VALUE(MID(A1;SEARCH("+";A1)+1;9999)))
My column A is formatted as text, and all values follow same pattern: =Value1+Value2
So the formula extracts Value1 and Value2 as text with MID functions, based on the position of + symbol. Then Excel convert both values into numeric with VALUE function. Notice there are 3 values, the third one is to make sure the cell stays at standar format (in some versions of Excel, like mine 2007, when involving text formatted cells into formulas, the formulated cell autoformat itself to text format, making the formula to work just once).
As you can see in the image, it works perfectly but this is just for pattern =Value1+Value2. For different patters you'll need different formulas.
If you want to make a formula to work with all patterns, then indeed you need VBA.
I have a series which goes something like this
John Blogs;John Bloggs;Jean Bloke;Jordon Bean, etc etc up to 10 names in a cell.
I need a formula to split each full name into a separate cell...I've been working with MID, FIND, etc but can't seem to get past the 3 name before coming unstuck!!!
Wonder if anyone can help!
Thanks
Ben
I would suggest using "text-to-column" function with semi-colon as a delimiter.
If you insist on using formula, this will work for you:
Let's assume you text is in cell A1. Then in B1 type =";"&A1&";".
Input 1 to 9 from cell A2 to I2.
In A3, type in the formula =MID($B$1,FIND(CHAR(1),SUBSTITUTE($B$1,";",CHAR(1),A2))+1,FIND(CHAR(2),SUBSTITUTE($B$1,";",CHAR(2),A2+1))-FIND(CHAR(1),SUBSTITUTE($B$1,";",CHAR(1),A2))-1).
Copy this formula to B3, C3, .. , I3.
Split your work over many columns rather than a single formula.
You are correct to use FIND() to get the offset of the ";".
And to use LEFT() to extract a name, with MID() to extract the remaining string.
Then you either have an empty cell, or you have a cell with up to 9 names in it.
Repeat the process across the sheet to get all your names, plus perhaps some cells containing #VALUE errors.
To display the output without the errors, use something like =IF(ISERR( A1 ), "", A1).
Of course hide all your working once done.
I have a simple query.
How can I format the text in cells in my Workbook.
If my cell has text ABC, I want it in the format 'ABC'. Is there any formula for this?
I am using Excel 2010.
I cannot do find and replace as all the values I want to alter are unique
Edit the cell or column you need to format
choose format cell
Select Custom from the bottom
Use the formula '#' .
# represents your text
Use CONCATENATE. For example if the cell is A1 then the function would be:
=CONCATENATE("'", A1, "'")
Just to add value to lgor's answer as He's already made the point.
"#" represents the text.
Just go to format cells > custom and surround the # with two Apostrophes, like: '#' and it will work.
I am horrible with excel. I rarely have to use it but today I do.
I have cells that have images that are comma separated. these cells are in the same column. i need to add a prefix lg_ to each comma separated image in the cell. I have done some reading on concatenate in excel and I am not sure if this is the right method to use. Does anyone have any good tricks/tips to accomplish this?
It currently looks like :
b3f9e6_1008a.jpg,4f57dc_1008d.jpg,9205eb_1008b.jpg,cb1c14_1008.JPG,ad8884_1008c.jpg
the result would look like this:
lg_75c552_599d.jpg,lg_a3a180_599a.jpg,lg_5c2ec4_599e.jpg,lg_dbb052_599b.jpg,lg_419420_599f.jpg,lg_8eb065_599c.jpg
note: images names are different because I just pasted what I already completed manually.
This should be on SuperUser.
What I would do is do Find..Replace on the comma and replace it with ",lg_" (without quotes). Then you need to prepend the strings with "lg_". You can do this by using another column and doing ="lg_"&A1 where you replace A1 with the proper cell reference. Drag this formula down and then copy and paste value that over the initial data.
Edit: Just because you seem new to Excel: To do Find..Replace hit Ctrl + H. The dialog box that will pop up is self explanatory.
This can also be done using the SUBSTITUTE command in a cell formula.
e.g.
Set C30 = "lg_"
Set D30 = "b3f9e6_1008a.jpg,4f57dc_1008d.jpg"
then in E30 type the following: =C30&SUBSTITUTE(D30,",",","&C30)
This does the same as ApplePie's answer, but with the added benefits that you do not need to do a manual replace, and "lg_" is not hard-coded so it can change depending upon the contents of a cell. Therefore you can copy the formula down a column and use different prefixes for each row. e.g.
IF C30="244" and D30="91,99" then E30 = "24491,24499"
IF C31="376" and D31="5,6,7" then E31 = "3765,3766,3767"