how to expand list into pattern in Excel? - excel

I have a list like this:
1
2
3
4
5
I am pulling those numbers into another spreadsheet, using vlookup.
I want to create a new list or pattern, that looks like this:
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
.. etc
How can I do that easily (my first list has 300 items, so dont want to do by hand)
Thanks!

Following the Scheme:
use the formulas:
C2 -> =A2
C3 -> =INDEX(A:A;ROUNDDOWN((ROW(G1)/$B$2)+2;0)) ' And Autocomplete
D2 -> =IF((ROUNDUP(ROW(G1)/($B$2+$B$4);0))-(ROUNDDOWN((ROW(G1)/($B$2+$B$4))+($B$4)/$B$2-$B$4/10;0))=1;INDEX(A:A;ROUNDDOWN((ROW(G1)/($B$2+$B$4))+2;0));"") ' And Autocomplete
The C column it's relevant to repeat without blanks, the column D it's relevant to the repeat with blanks.
In the cells B2 put the number of repetition and in the cell B4 put the blanks cells.
If you have more that one column to copy use the same code for every column...
If you need to have only values, at the end copy and paste with value ...
Warning: The formula in column D work with low number of blanks and Repeat... Eventually you need to recalibrate.

Related

How to find and replace from a List in Excel

Not using VBA but just simple excel, can anyone help me find a solution to this problem? Would greatly appreciate it!
I have a list of Names in Sheet 1 like below
-
A
1
sp_abc_Rick
2
sp_abc_Jabba_the
3
sp_abc_Dany
4
sp_random_Rick
5
sp_random_Jabba_the
6
sp_random_Dany
7
sp_constant
8
sp_ripley_art_Dany
9
sp_ripley_art_Jabba_the
10
sp_wakeup
I have a list of Mapping Table in Sheet 2 like below
-
A
B
1
Rick
Morty
2
Jabba_the
Hutt
3
Dany
Dragon
I wish to have a result in Sheet 1, in column B, like below
-
A
B
1
sp_abc_Rick
sp_abc_Morty
2
sp_abc_Jabba_the
sp_abc_Hutt
3
sp_abc_Dany
sp_abc_Dragon
4
sp_random_Rick
sp_random_Morty
5
sp_random_Jabba_the
sp_random_Hutt
6
sp_random_Dany
sp_random_Dragon
7
sp_constant
sp_constant
8
sp_ripley_art_Dany
sp_ripley_art_Dragon
9
sp_ripley_art_Jabba_the
sp_ripley_art_Hutt
10
sp_wakeup
sp_wakeup
To give you a context of the number of rows. Sheet 1 will be bigger with more than 1000 rows. Sheet 2 (Mapping Table) is constant set of rows. Currently it is about 100 rows.
You can use a formula like shown below using LOOKUP(), SEARCH() with SUBSTITUTE()
• Formula used in cell B1
=IFERROR(SUBSTITUTE(A1,LOOKUP(9^9,SEARCH($D$1:$D$3,A1),$D$1:$D$3),
LOOKUP(9^9,SEARCH($D$1:$D$3,A1),$E$1:$E$3)),A1)
There you go. There may have other better solution. This is what I got.
All in column B.
=IFERROR(CONCAT(MID(A1,1,MATCH(1,(CODE(MID(A1,ROW($Z$1:$Z$255),1))<90)*(CODE(MID(A1,ROW($Z$1:$Z$255),1))>=65),FALSE)-1),INDIRECT(CONCAT("sheet2!b", MATCH(MID(A1, MATCH(1,(CODE(MID(A1,ROW($Z$1:$Z$255),1))<90)*(CODE(MID(A1,ROW($Z$1:$Z$255),1))>=65),FALSE), LEN(A1)), Sheet2!$A$1:Sheet2!$A$300, 0)))),A1)
Break down is as follow;
Let's start put things from Column C onward.
Column C, to find the index of the first capital letter from the text.
ref: http://dailydoseofexcel.com/archives/2007/02/21/find-position-of-first-capital-letter-in-a-string/
=MATCH(1,(CODE(MID(A1,ROW($Z$1:$Z$255),1))<90)*(CODE(MID(A1,ROW($Z$1:$Z$255),1))>=65),FALSE)
Column D, cut the name part by using upper case letter index from column C, sp_abc_Jabba_the -> Jabba_the
=MID(A1, C1, LEN(A1))
Column E, search row number from Sheet2 by matching Column D's name with Sheet 2's Column A, this will get matching row number from Sheet2.
=MATCH(D1, Sheet2!$A$1:Sheet2!$A$300, 0)
Column F, get Sheet2's Column B value by the row number from Column E.
=INDIRECT(CONCAT("sheet2!b", E1))
Column G,
Cut "sp_abc_" from "sp_abc_Rick"
Concat "sp_abc_" with Column F's "Morty".
If there is any error, use Column A value as default.
. <- this dot is intentional. please ignore.
=IFERROR(CONCAT(MID(A1,1,C1-1),F1),A1)
Try:
Formula in B1:
=BYROW(A1:A10,LAMBDA(a,LET(b,TEXTBEFORE(a&"|","_"&A12:A14&"|",-1),IFERROR(CONCAT(IF(b&"_"&A12:A14=a,b&"_"&B12:B14,"")),a))))
The concatenation with a "|" would assert we only replace values when at the exact end of the input. Just in case there would be a stray (for example) 'Rick' somewhere before the end.

How to match columns and adding blank rows in excel

I have an excel file with 5 rows in column A and B, and 3 in column C and D (in reality though, I have a couple of hundreds of rows). Column B consists of text belonging to A, and D of text belonging to C. Column C has some of the values found in column A.
It looks like this:
A B C D
1 1 stringA1 1 stringC1
2 2 stringA2 2 stringC2
3 3 stringA3 4 stringC3
4 4 stringA4
5 5 stringA5
Now, I would like to match the numbers in column C with those in A, so that matches are put in the same row. For those rows in A for which there is no match in C, I want to have blank cells after column B.
It would look like this in this case:
A B C D
1 1 stringA1 1 stringC1
2 2 stringA2 2 stringC2
3 3 stringA3
4 4 stringA4 4 stringC3
5 5 stringA5
I have some idea that I should use VLOOKUP and maybe Conditional Formatting, but unfortunately I am not very experienced in excel. Could someone please suggest a way to do this?
Enter the following formula in Cell E1:
=IF(IFERROR(MATCH(A1,$C$1:$C$5,),"")<>"",INDEX($C$1:$D$5,IFERROR(MATCH(A1,$C$1:$C$5,),""),1),"")
and this one in Cell F1:
=IF(IFERROR(MATCH(A1,$C$1:$C$5,),"")<>"",INDEX($C$1:$D$5,IFERROR(MATCH(A1,$C$1:$C$5,),""),2),"")
Using Helper Column:
You can also do this using a helper column.
In Cell E1 write:
=IFERROR(MATCH(A1,$C$1:$C$5,),"")
Then in Cell F1 write:
=IF(E1<>"",INDEX($C$1:$D$5,E1,1),"")
And finally in Cell G1 write:
=IF(F1<>"",INDEX($C$1:$D$5,E1,2),"")
This was answered by #user3514930 to a question here.
You can directly use this formula in D2 and copy downwards:
=IF(A2 = C2, A2, "")
Now if you have formulas in A2, C2, type in those formulas in place of A2, C2 in the above.

Excel line up data

I'm a total Excel nub and can't find the answer I'm looking for. Must be easy peasy, but since I'm not into Excel I also don't know what to look for. Sorry if I'm having my question wrong.
I have output in Excel like this:
A 1
A 2
A 3
A 4
B 1
B 2
B 3
B 4
B 5
B 6
and I want it like this:
A 1 2 3 4
B 1 2 3 4 5 6
this question is quite complex in a way.
let me explain it more in detail:
as you see above, we have two columns A and B, you have text strings in column A , these text strings could be repeated. As you see in the example, there are 4 As, 5 Bs, 3 Cs 1 D and 3 Es. In column B each one of these strings have different corresponding values. For example, text strings B in column A has five corresponding values in column B, namely 11, 12, 13, 14, 15, and 16.
Now we want a list of UNIQUE values from column A, and lets say, we put this list in column C and then for each of these unique values in column C we want to list their corresponding cells in column B and put them HORIZONTALLY in front of each of these unique text strings in column C.
For this you need two kinds of formulas:
Formula 1 to calculate the list of the unique values in column A :
this goes in C2:(leave C1 empty)
=IFERROR(INDEX($A$1:$A$999;MATCH(0;FREQUENCY(IF(EXACT($A$1:$A$999;TRANSPOSE($C$1:C1));MATCH(ROW($A$1:$A$999);ROW($A$1:$A$999)); ""); MATCH(ROW($A$1:$A$999);ROW($A$1:$A$999))); 0)); "")
this is an array formula, so press ctrl+shift+enter to calculate the formula, and drag and fill down as many as you want in column C.
*Formula 2 to find and list horizontally the values from column B *
=IFERROR(INDEX($B$1:$B$999;SMALL(IF($C2=$A$1:$A$999;ROW($A$1:$A$999)-ROW($A$1)+1);COLUMN(A$1)));"")
this is an array formula, so press ctrl+shift+enter to calculate the formula, put this in D2 and drag and fill down until the last cell of column C. then select D2 to D6 and drag and fill horizontally. You should get all of the corresponding cells in front of each unique item.
P.S. adjust the formulas to meet your regional settings by replacing ; with , I suppose.
Finally here is the link to an example sheet downloadable from here .
This is very generic but hopefully will help.
Highlight the cells that you want to transpose to.
Type the equation..."=TRANSPOSE(B1:B4)" (edit as necessary).
While the cells are still highlighted, press "ctrl+shift+enter". (brackets should appear around the equation)
Finish editing the cells.
Celebrate

A function that will lookup a reference

Before I get started thanks for taking your time and helping.
This is what my worksheet looks like:
Row # B C D E F
2 1 Product 1 B2 B3 B4
3 2
4 6
5 1 Product 2 B5 B6
6 5
7 4 Product 3 B7
I was trying to follow this formula: (The best answer one or green check mark) return values from multiple matching rows
I got all the way to the =IFERROR(INDIRECT(lookups!H5),"") but can not get this to work.
What I am tying to do is order the numbers in Column B to go to the right of the product. Which I was able to get the column it is in (B) and the row number it is in (B2). I would like to change the value (B2) to the number that is there.
I would like it to look like this:
Row # C D E F
2 Product 1 1 2 6
3
4
5 Product 2 1 5
6
7 Product 3 4
If someone could help explain this to me or find a better way that would be great.
Not sure what is to happen to columnB but if you replace B with "="B throughout columns D:F then select each of these in turn and apply Text to Columns with Tab as the delimiter the 'cell references' convert to formulae referring to the values in B. If you want to delete columnB copy D:F and Paste Special, Values over the top.

Microsoft Excel 2010: Help making a Formula to up Values by a repeating pattern

I have a Spreadsheet, and inside this sheet contains a column with numbers, I want to make a formula that will go down that Column and do basically this.. Values: 1 will be 9.50. 2 will be 9.75. 3 will be 10.00. Ect going up to Value of 100? Is that possible for a Formula? I keep playing with it but can't really seem to get it down. Any help would be appreciated.
Column A: 1
1
1
1
1
2
2
2
2
2
2
2
2
2
3
3
3
3
There is not a set amount to how many values are in there.
this should do it supposing that column A has these values 1, 2 ...etc that your computing will be based on
=MIN(9.25+A1*0.25;100)*COUNT(A1)
In A2, enter the formula
=A1 + (9.5-A1)
then in the cell just below it (A3), enter
=A2+0.25
Assuming A1 is the top left. Copy the formula in A3, select the next 399 cells and paste. Then select A2 - A364 and copy. Then select B2 -xx364 and paste. xx is the last column with data. If you want, set the height of your first column to 0 to hide it.
=(A1-1)*0.25+9.5 where A1 contains any number you want

Resources