concat with sequence number

jack29

New Member
Joined
Apr 28, 2021
Messages
19
Office Version
  1. 365
Platform
  1. Windows
I have quite few 100's rows in my excel, which needs to be added with below formula and dragged across down. I have tried SEQUENCE formula with no luck.


=CONCAT("<execute order="&TEXT(CHAR(34)&SEQUENCE(1,1,1,1)&CHAR(34),"Text"),"MR")

This will return below

<rule order="1"MR

Now, for starting cell it will be 1 number and when i drag to next cells i want that number to be incremented by 1 value, so it displays in next row as

<rule order="2"MR
Next row as

<rule order="3"MR

So on....
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
My guess:
VBA Code:
=CONCATENATE("<execute order="&TEXT(CHAR(34)&SEQUENCE(100,1,1,1)&CHAR(34),"Text"),"MR")

This will return 100 lines, provides the cells below the one you populate with the formula is free (otherwise you will have the error #SPILL)

You might replace that "100" for example with the count of how many rows are in one of the columns; for example
Code:
=CONCATENATE("<execute order="&TEXT(CHAR(34)&SEQUENCE(COUNTA(C:C),1,1,1)&CHAR(34),"Text"),"MR")
This will return so many lines according how many cells are populated in column C
 
Upvote 0
My guess:
VBA Code:
=CONCATENATE("<execute order="&TEXT(CHAR(34)&SEQUENCE(100,1,1,1)&CHAR(34),"Text"),"MR")

This will return 100 lines, provides the cells below the one you populate with the formula is free (otherwise you will have the error #SPILL)

You might replace that "100" for example with the count of how many rows are in one of the columns; for example
Code:
=CONCATENATE("<execute order="&TEXT(CHAR(34)&SEQUENCE(COUNTA(C:C),1,1,1)&CHAR(34),"Text"),"MR")
This will return so many lines according how many cells are populated in column C
Sorry, I forgot to mention I have few cell references which gets auto incremented when i Drag Example:

=CONCAT("<execute order="&TEXT(CHAR(34)&SEQUENCE(1,1,1,1)&CHAR(34),"Text"),"MR", A2, B2)
=CONCAT("<execute order="&TEXT(CHAR(34)&SEQUENCE(1,1,1,1)&CHAR(34),"Text"),"MR", A3, B3)
=CONCAT("<execute order="&TEXT(CHAR(34)&SEQUENCE(1,1,1,1)&CHAR(34),"Text"),"MR", A4, B4)
So on
 
Upvote 0
How about
Excel Formula:
=LET(s,SEQUENCE(100),CONCATENATE("<execute order="&CHAR(34)&s&CHAR(34),"MR",INDEX(A2:A100,s),INDEX(B2:B100,s)))
 
Upvote 0
How about
Excel Formula:
=LET(s,SEQUENCE(100),CONCATENATE("<execute order="&CHAR(34)&s&CHAR(34),"MR",INDEX(A2:A100,s),INDEX(B2:B100,s)))

Thanks for the solution, I tried above but strings are getting overlapped to next row. please view the attachment.
 

Attachments

  • Test.jpg
    Test.jpg
    154.7 KB · Views: 47
Upvote 0
A possible option?
VBA Code:
=CONCAT("<execute order="&TEXT(CHAR(34)&ROW(A1)&CHAR(34),"Text"),"MR", A2, B2)
Copy down as needed
 
Upvote 0
Solution
You need to remove the A2 & B2 from your formula.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,818
Members
449,049
Latest member
cybersurfer5000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top