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.
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