formula to generate a string between two columns

mountainman88

Board Regular
Joined
Jun 22, 2019
Messages
109
Office Version
  1. 2016
Platform
  1. Windows
I want to generate the following string: "Col x, Col y, Col x, Col z, Col aa, Col ab, Col ac, Col ad, Col ae" which is a list of consecutive excel columns prefixed with 'Col ' and separated by commas.

How can I generate this in a formula using only the first and last value? ie z and ae. I'd like this to work for any consecutive set of columns in excel. Bonus if the formula also works in google sheets.

The purpose is to generate the string for a google query formula, if there is an easier way please let me know.

Thanks!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Thanks for asking.
You have to insert required text in rowA1 upto desired and then have to combine.
Here is formula...

=CONCATENATE("COL "&(A1),CONCATENATE(", COL "&(B1),CONCATENATE(", COL"&(C1),CONCATENATE(",COL"&(D1),CONCATENATE(",COL"&(E1),CONCATENATE(",COL"&(F1),CONCATENATE(",COL"&(G1),CONCATENATE(",COL"&(H1),CONCATENATE(",COL"&(I1),CONCATENATE(",COL"&(J1)))))))))))

Expected results....
COL A, COL X, COLY,COLZ,COLAA,COLAB,COLAI,COLJJ,COLKK,COLXX
Waiting for your response.
 
Upvote 0
This will work in Sheets, but not in Excel.
Excel Formula:
=ARRAYFORMULA("Col "&TEXTJOIN(", Col ",,SUBSTITUTE(ADDRESS(1,SEQUENCE(1,5,24),4),"1","")))
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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