count row and make max permutation - excel

How can I make permutation of name list? For ex. I have 5 names on A column. Firstly count A column and give me only permutations 5 ly to b column in cell with separete "," changing only the first names...
Column A
tom
Lila
John
sam
steave
Column B
Tom,Lila,John,Sam,Steave
Lila,Tom,John,Sam,Steave
John,Tom,Lila,Sam,Steave
Sam,Tom,Lila,John,Steave
Steave,Tom,Lila,John,Sam

This is a fairly simple one:
In Cell B1 enter this formula: =A1&","&A2&","&A3&","&A4&","&A5
This will build a string from all cell values with a , in between them.
Then in B2 enter this formula: =A2&","&SUBSTITUTE($B$1,","&A2,"") and drag down.
It will start with the value of cell A2, add a comma and then add the string from cell B1 in which it substitutes the value in cell A2 with ""(no character), effectively removing it from the string.
Edit as per comment from OP
(Adapt range A1:A10 as needed)
To make this responsive I have added a helper column.
In column B I now have a helper column with the following formula:
In B1: =IF(A1<>"",A1,"")
In B2: =IF(A2<>"",B1&","&A2,"") drag this down.
In cell C1 I have this Formula: =IF(A1<>"",INDEX(A1:A10,COUNTA(A1:A10)),"") This will put the longest string of data into the cell.
In C2 then the original formula, wrapped with an IF to account for empty cells, can be inputted: =IF(A2<>"",A2&","&SUBSTITUTE($B$1,","&A2,""),"")
This are then the results:

Related

Excel CONCAT columns B and C while they have similar values at column A

How can I CONCAT two columns values while the column A has similar values in each rows in Excel?
Something like following, what I need is to CONCAT values of rows in Columns B and C while the A is similar:
Assuming you are on Excel 365 and have use of FILTER() and TEXTJOIN(), you can enter the following formula into column D and drag down:
=IF(COUNTIF($A$1:A1,A1)=1,TEXTJOIN(":",TRUE,FILTER($B$1:$C$15,$A$1:$A$15=A1)),"")
This checks if the value in column A is the first occurrence of that value. If it is, it will output a colon delimited string of every value in columns B:C where col A equals the current value in column A.
you can use if command
if cellA1<>cellA2 then you concatenate b2 and C2
else you concatenate D2 and B2, and C2.
You can use a helper column to do this but you need to have a header row for this to work. Assuming your first row of data is in A2, B2, C2:
paste this into D2:
=IF(A2=A1,D1&","""&B2&""":"""&C2&"""",""""&B2&""":"""&C2&"""")
and paste this into E2:
=IF(A2=A3,"",D2)
Copy these two down to every row in the data.
Note: This version puts the concatenated result in D at the last row of the group instead of at the first row of the group like your screenshot shows.

Excel: if cell B2 contains a certain char then value of cell D2=E2 if not then D2, then I want to increment to E3 if Im at BX?

I have the following table, what I am trying to do is to automatically generate the column D (highlighted in yellow below).
If the previous cell in column B (starting B2) has a bracket "(" then I want it to be equal
=IF(ISNUMBER(SEARCH("(";B1));E2;D1) [this equation is in D2]
the trick is as seen in the example below B3 till B17 have no "(" so its equal the previous value which is the above D, but in B18 it sets to E18, however I want to be E3 and so on till the end. Any help?
Maybe you can just count how many cells containing brackets there have been in column B before the current row, and use that to pick up the next item in column E?
=INDEX(E:E,COUNTIF(B1:B$1,"*(*")+1)

Formula to find the last populated cell in a column and add to it?

If column A is marked with an X, the adjacent cell in column B will find the last populated cell in column B and simply +1 to that.
For example: If A1 is marked and B1 is HF2056, and it skips a row so that A3 is marked with an X, B3 would need to auto fill to be HF2057.Image with fake numbers for example
So how do I formulate it so that if a cell in column A is marked with an X, the adjacent cell in column B will find the last filled cell in B with data and fill in the new number?
I feel like this may be an ISBLANK formula but I can't figure it out.
Thank you in advance!
Assume : A1 is X and B1 is HF2056, A2 is blank, A3 is X
Then, in B2, formula copied down :
=IF(A2="","",LEFT(LOOKUP(1,0/(A$1:A1="X"),B$1:B1),2)&RIGHT(LOOKUP(1,0/(A$1:A1="X"),B$1:B1),4)+1)
And, formula result:
B2 : (blank)
B3 : HF2057
Remark :
The above formula result will give max number in HF10000.
If you want the number keep to increase by 1, the B2 formula will be changed to :
=IF(A2="","",LEFT(LOOKUP(1,0/(A$1:A1="X"),B$1:B1),2)&RIGHT(LOOKUP(1,0/(A$1:A1="X"),B$1:B1),LEN(LOOKUP(1,0/(A$1:A1="X"),B$1:B1))-2)+1)

Return a third cell value at the location of another cell if two other cells match

https://i.stack.imgur.com/WJAS0.png (Sorry for the link, I don't have enough rep to post an image)
I'm trying to get a formula where if any of the values found in column D (taking into account that some cells have multiple values ie. cell D4) match a value in Column A then return the value of the same row associated with Column D.
For example, in cell D4 the number 786403213972 matches A2 then cell C4 will return 100.
Following up on your last question here, hereby a way to do this (beware, it's long and tricky)
Formula in C2:
=IF(SUMPRODUCT(--(ISNUMBER(SEARCH(TRIM(MID(SUBSTITUTE(D2,CHAR(10),REPT(" ",99)),(ROW(OFFSET($A$1,,,LEN(D2)-LEN(SUBSTITUTE(D2,CHAR(10),""))+1))-1)*99+((ROW(OFFSET($A$1,,,LEN(D2)-LEN(SUBSTITUTE(D2,CHAR(10),""))+1)))=1),99)),TRANSPOSE($A$2:$A$7)))))>0,B2,"")
Confirm as array formula through Ctrl+Shift+Enter
Drag down...

Performing a search in excel for subtraction based on cell contents

I am trying to subtract certain cells from 1 single master cell, if other cells contain a certain string.
For example: Cell B2 will be the master with a total dollar amount.
Now, if any row in column C were to contain "text" I want to subtract the number in the same row, but in column D, from B2.
Ergo, if C3 has "text" and D3 has "3", subtract 3 from B2.
My problem is that I don't even know where to start. How do you get a formula to iterate through rows? How do you get that formula to assign the same row to the C and D operations?
If the original formula in B2 was:
=SUM(A:A)
then replace it with something like:
=SUM(A:A)-SUMPRODUCT(--(C:C="text")*(D:D))

Resources