Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Concatenate or TextJoin Same Cell Multiple Times based on Value in another Cell?

I’m struggling with a problem in Excel right now with some Amino Acid data.

The idea is that i would have a string of AA residues that need to be polymerized (functionally contatenated to themselves) a number of times based on a multiplier.

So, if I have a sequence AAGKLY, and I want to polymerize it 4 times, I should end up with AAGKLYAAGKLYAAGKLYAAGKLY.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Ideally, AAGKLY would be in a cell, the number 4 would be in a cell next to it, and my formula would spit out the full concatenation in the final cell.

Concatenate() seems to be my best bet, but I can’t use VBA to do any sort of While Loop. My other option seems to be a massive if statement, but then I have to worry about someone using this sheet to do something like a 50 times polymerization while I’ve only written up to 40 if statements. Is there a good way to leverage the concatenate function?

>Solution :

I believe that the REPT function is what you are looking for:

=REPT("ABC",4) => ABCABCABCABC
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading