Split multiple names separated by semicolon into separate cells - Excel - excel-formula

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.

Related

Is there a way to add a formula to unique data points in excel?

I am trying to clean some data with this format:
A1 B1 C1
"0,1,0,E,1" "0,0,0,E" "0,1,1,1,2,E"
To obtain the information, I will need to sum up each cell individually, and then calculate the sum over a row.
So far, I have replaced all of the "E"s (for empty) with no data, which removed the E's, and I have replaced all of the commas with "+" signs to add the numbers in the cell. To run the formula of each cell, I will need to now place an "=" in front of each text string, however, if I copy it in with something like "="="&A1" the formula will not run because excel is reading the = as a letter or symbol and not an operator. Do you know of a way to fix this problem?
Thank you so much!
I think this will work for your version ...
=SUM(FILTERXML("<d><c>" & SUBSTITUTE(A1,",","</c><c>") & "</c></d>","//c"))
That's applied like below ...
... there's always someone smarter than me but that seems to work.
It’s not an in place replacement but it keeps your source data intact and provides a nice reconciliation point.
Using a separate sheet for each column of values, given data in cell A1 of
0,0,0,1,0,1,1,E,1,0
In C1, enter the formula
=IFERROR(MID(SUBSTITUTE(SUBSTITUTE($E$14,",",""),"E",""),COLUMN()-2,1)*1, "")
and drag the fill handle to to the right for as many cells as the longest number of data points you have.
Enter your SUM()formula in B1 (you can use the shortcut ALT + =).
Have you tried something like this, please refer the image, where its showing as per your required output, three alternative formulas
1.) Formula used in cell B2
=SUMPRODUCT(IFERROR(--MID($A2,ROW(INDIRECT("1:"&LEN($A2))),1),0))
2.) Formula used in cell D2
=SUMPRODUCT(IFERROR(--MID($C2,SEQUENCE(LEN($C2)),1),0))
The 2nd formula is applicable to Excel 2021 & O365 Users only
3.) Formula used in cell F2
=SUM(IFERROR(--MID($E2,ROW($1:$1000),1),0))
This is an array formula, so requires to press CTRL SHIFT ENTER !
Here is an update, the last formulas, which i have shared, shall work only when the digits are less than 10, however the present formula, shall work for all number of digits,
Formula used in cell B17
=SUMPRODUCT(IFERROR(--MID(SUBSTITUTE($A17,",",REPT(" ",100)),COLUMN(A1:Z1)*99-98,100),0))
Please adjust your range accordingly as per your data.

Excel noob needs help Replacing a mid value with a different value using excel formula

I'm new to StackOverflow and to Excel formulas!
I'm trying to replace the word "GIL64000" with the word "GIB64000", I need to do this across many cells A2: H6; A9: G13, etc.
The cells themselves contain information as follows: "GIL64000_XX_X" with "XX" varying between WH, BL,OR,PU, etc and the"_X" ranging from L, M, S, XL, XXL (shirt sizes).
So I have cells with values like: "GIL64000_OR_S" , "GIL64000_BL_XXL" , "GIL64000_MIN_M" , "GIL64000_MIN_L" etc.
I've tried to get the replace function working by doing this: =REPLACE("GIL64000";3;1; "B")
But it only does this within the cell I have the formula in.
I've tried to add A2: H6 to the formula, but it doesn't accept it and returns with #VALUE! error: =REPLACE(A2:H6;3;1;"B")
I tried some other string like "MID" function, but I can't figure out how to use MID with REPLACE: =REPLACE(MID(A2: H6;3;1; "B"))
I tried to follow some guides and I still can't seem to get it working.
In essence, what I Want is the word "GIL64000" with word "GIB64000" across all my cells and to be able to change the formula as I need it in the future for other values not only "GIL64000"
The REPLACE command only takes in one reference of the cell, and not a range.
Only Change which you need to make is =REPLACE(A2;3;1;"B"), and then just copy the formula (i.e. Ctrl + C, and Ctrl + V on the other cells where you want to change this).
Also, this cannot be applied on the cell itself but would be applied on an adjacent cell.
Let me know if this helps.
There is also the substitute() function which will work, have shown 2 variations - both will drag down, but the second allows customizing the characters to replace. You could put $ on the B3 and C3 for an absolute reference.
See:
Note: I did not just look for "B" although you could - it depends what other data is there...
I know you said you want a formula, but in this case, don't sneeze at the idea of using a CTRL+H. This looks like the perfect scenario for one.

Count Number of Instances of string using FORMULATEXT

I have data that extends from column A1 to F1. All the cells contain VLOOKUP formulas looking up data from an external Excel file.
I want to be able to insert a formula in column G1 to count the number of times a certain filename is used in columns A1 to F1.
I know that if the data in cells A1 to F1 were NOT formulas I could use something like the below in G1 if I was searching for the string "filename.xlsx" using wildcards:
=COUNTIF(A1:F1, "*filename.xlsx*")
However, as A1 to F1 contain formulas, I assume I would need to use FORMULATEXT, in order to look within the VLOOKUPs. I have tried the below, but it doesn't work:
=COUNTIF(FORMULATEXT(A1:F1),"*filename.xlsx*")
Does anyone know if there is a way to do this? it would also be good if the criteria within the COUNTIF was a cell reference. However, that isn't essential.
Thanks
Try using this array formula
=COUNT(SEARCH("filename.xlsx",FORMULATEXT(A1:F1)))
confirm with CTRL+SHIFT+ENTER
or a non array version.....
=SUMPRODUCT(ISNUMBER(SEARCH("filename.xlsx",FORMULATEXT(A1:F1)))+0)

search multiple columns for a value and concatenate the address of the cells

I have been breaking my head over this formula for sometime now. I have found a solution which is too big and not so convenient to use every time. So can any Excel Expert give me a solution/suggestion?
Column A contains 150 values. Column D to R contains a table in which I need to look up the values in A one by one. I want to return address of all the cells that contains the value.
For example, Value in A2 is present in cells D5, E15, H10, R3 then my result should be D5,E15,H10,R13.
Please Note that some columns may not contain the value of A2, I do not want them displayed.
Here is the formula I have written:
=CONCATENATE(
IF(A2=IF(COUNTIF(D:D,A2),VLOOKUP(A2,D:D,1,FALSE),""),ADDRESS(MATCH(A2,D:D,0),4,4),0),",",
IF(A2=IF(COUNTIF(E:E,A2),VLOOKUP(A2,E:E,1,FALSE),""),ADDRESS(MATCH(A2,E:E,0),5,4),0),",",
IF(A2=IF(COUNTIF(F:F,A2),VLOOKUP(A2,F:F,1,FALSE),""),ADDRESS(MATCH(A2,F:F,0),6,4),0),",",
IF(A2=IF(COUNTIF(G:G,A2),VLOOKUP(A2,G:G,1,FALSE),""),ADDRESS(MATCH(A2,G:G,0),7,4),0),",",
IF(A2=IF(COUNTIF(H:H,A2),VLOOKUP(A2,H:H,1,FALSE),""),ADDRESS(MATCH(A2,H:H,0),8,4),0),",",
IF(A2=IF(COUNTIF(I:I,A2),VLOOKUP(A2,I:I,1,FALSE),""),ADDRESS(MATCH(A2,I:I,0),9,4),0),",",
IF(A2=IF(COUNTIF(J:J,A2),VLOOKUP(A2,J:J,1,FALSE),""),ADDRESS(MATCH(A2,J:J,0),10,4),0),",",
IF(A2=IF(COUNTIF(K:K,A2),VLOOKUP(A2,K:K,1,FALSE),""),ADDRESS(MATCH(A2,K:K,0),11,4),0),",",
IF(A2=IF(COUNTIF(L:L,A2),VLOOKUP(A2,L:L,1,FALSE),""),ADDRESS(MATCH(A2,L:L,0),12,4),0),",",
IF(A2=IF(COUNTIF(M:M,A2),VLOOKUP(A2,M:M,1,FALSE),""),ADDRESS(MATCH(A2,M:M,0),13,4),0),",",
IF(A2=IF(COUNTIF(N:N,A2),VLOOKUP(A2,N:N,1,FALSE),""),ADDRESS(MATCH(A2,N:N,0),14,4),0),",",
IF(A2=IF(COUNTIF(O:O,A2),VLOOKUP(A2,O:O,1,FALSE),""),ADDRESS(MATCH(A2,O:O,0),15,4),0),",",
IF(A2=IF(COUNTIF(P:P,A2),VLOOKUP(A2,P:P,1,FALSE),""),ADDRESS(MATCH(A2,P:P,0),16,4),0),",",
IF(A2=IF(COUNTIF(Q:Q,A2),VLOOKUP(A2,Q:Q,1,FALSE),""),ADDRESS(MATCH(A2,Q:Q,0),17,4),0),",",
IF(A2=IF(COUNTIF(R:R,A2),VLOOKUP(A2,R:R,1,FALSE),""),ADDRESS(MATCH(A2,R:R,0),18,4),0))
As I said, this works but I am looking for a simpler and smaller formula.
Hint: Maybe using array can help?
Thanks in advance :)
What you are trying to accomplish is not a great fit for Excel formulas, but it can be done with a smaller, simpler formula dragged across 15 columns instead of 1 giant complicated formula that tries to do everything at once.
Assuming column A has 150 values (from A1 to A150), and there is a table going from D1 to R50...
Enter =S1&IFERROR(","&ADDRESS(MATCH($A1,D$1:D$50,0),COLUMN(D1)),"") into T1.
Drag the formula across to AH1.
Enter =RIGHT(AH1,LEN(AH1)-1) into AI1.
Select T1 to AI150 and press Ctrl-D.
Column AI1 will contain the results you are looking for.
How does this work?
The formula in T1 begins by taking the result of one cell to the left (which is blank). Then it concatenates this with the address of the first match in column D (prefixed by a comma). If there is no match, it just concatenates blank (""). As you drag this formula to the right, it keeps concatenating addresses as matches come up (or blank if there are none). When you get to the end, you will have looked for matches in all 15 column of your table.
The formula in AI1 just strips off the initial comma if there is one.

How to split a single row into multiple columns in Excel

In Excel, I want to split up the data in row 1 into four single columns. A1:D1 should remain in place. E1:H1 should become A2:D2 and so on.
I am currently using this formula in A2:
INDEX($1:$1;(ROW()-1)*4+COLUMN()-1)
... But I am getting a #REF! error.
How do I solve this problem?
Try using this formula in Cell A2 (you may need to use semicolon instead of commas in non-English version of Excel)
=OFFSET(A$1,0,(ROW()-1)*4)
Then, copy & paste or drag the formula across columns B thru D, as many rows as you need.
Alternatively, your formula (=INDEX($1:$1,(ROW()-1)*4+COLUMN()-1)), is not returning an error for me, however it is not returning the correct column. If you prefer the Index function you can use:
=INDEX($1:$1,(ROW()-1)*4+COLUMN())
Substitute semicolons for commas if needed.

Resources