Concatenating alternate columns - vba

I have 10,000 rows and unlimited data in columns. Two parameters in adjacent columns and are repeating after 13 unwanted columns.
I want to concatenate these adjacent columns of a row separated by space
eg:
concatenate(B2,C2,"",P2,Q2,"",AC,AD,"",....)
But I dont know upto which column the data is present.
Can you suggest me a macro which concatenates data upto blank column in one cell of a row and same is continued for first 10,000 rows.
Thanks a lot for help !

First off, are all the rows terminating at the same column? i.e. does every row have data in column AD but not AE?
If the answer to the above is 'yes', then you'll probably want to take a look at:
Range.End()
which is used like:
YourSheet.Range(YourRange).End(xlToRight).Column
(see here for more info)
This will return either
the last column with data (when the starting cell contains data)
or
the first column with data (when the starting cell is empty).
not the last column without data!
Based on your example in the question, your ranges probably start in Column B, P, AC, etc.
If the answer to the above is 'no', then you can use similar functionality, but you'll have to loop through each row...

Related

Find number of rows in an already filtered Column A in Excel

I have got an Excel spreadsheet. This spreadsheet has just one tab in it. The Tab name is dynamic in nature and changes every week also the number of rows.
I have column A filtered already with a VBA macro. A1 has the header.
Now, I wanna find how many rows are there in this already filtered column A.
I am looking for any VBA function.
I have tried using Subtotal function.
=Subtotal(103,A2:A1345)
But I don't know the end range. As of now the end range is A1345. It will change every time in future if the new rows are added.
I tried multiple things but those did not work. I am quite new to VBA.
If A1 will never be blank, you could use (in a column other than A)
=Subtotal(103,A:A)-1.
Or, if there will be data below your table not to be counted, then format your table as a Table and use structured references (and this formula could go into column A)
=SUBTOTAL(103,Table1[column_header])
You can put the formula in column A if you use another column's last populated cell as the demarcation point.
If column B contains numbers then,
=subtotal(103, a2:index(a:a, match(1e99, b:b)))
If column B contains text then,
=subtotal(103, a2:index(a:a, match("zzz", b:b)))

Master Spreadsheet, Referenced by presentation spreadsheet - potentially hard?

I just started a project for a client company and they're needing something kind of unrelated, I'm hoping to get some help with that here.
The situation is this. I have a continually updating "master" spreadsheet located at \ServerA\Folder1\Folder2\MasterSpreadsheet.xlsx. This houses dates ascending left to right on row 219. The dates are ascending(Format mm/dd/yyyy), but not sequential(they skip a few days here and there). The Quantity(row 220) corresponds with dates(row 219). These both start on Column C.
FIRST "Set" of dates/qty on row 219/220 Column C.
SECOND "Set" of dates/qty on row 224/225 Column C.
I then have a "Presentation" spreadsheet that will reference the master.
Dates are ascending top to bottom (range 4/25/18 - 12/31/18) in column F and ARE SEQUENTIAL, qty in column G, starting row 9.
So basically what i need is an excel statement that will do this, in whatever fashion is needed.
If the FIRST AND SECOND sets' dates in the date row in MASTER match(could be in column C, all the way to column CZ), the quantities for them both will be added and placed into the correct row (Dates match) in the PRESENTATION spreadsheet.
If the FIRST AND SECOND sets' dates in the date row in MASTER DO NOT match, then they just go to their respective dates on the PRESENTATION spreadsheet.
I hope that was clear enough! Sorry to ask, i can do the rest but this really has me stumped.
Thank you very much!!!!!
I do not understand why you differentiate match or not match for master sets date.
I suggest in sheet PRESENTATION from cell G9 :
=SUMIF(MASTER!$C$219:$CZ$219,PRESENTATION!F9,MASTER!$C$220:$CZ$220)+SUMIF(MASTER!$C$224:$CZ$224,PRESENTATION!F9,MASTER!$C$225:$CZ$225)

Excel - Loop through rows and reverse order

I was looking for a code that loop through all rows (I got too many), and change order for every three rows. I have a form of rows like this...
see image
Need to loop through all rows in column B and reverse order for every three rows and get this (for better analysis). Thank you
see image
If I understand your question correctly, type this formula into a cell in column B and drag down as far as necessary:
= INDEX(A:A,ROW()+2*(1-MOD(ROW()-1,3)))
VBA is not needed. This formula copies the values from column A to column B, but reverses the order of the entries every three rows as shown in your example image from your question.
See below.

How to parse multiple rows with concatenated data into a single column

I have an excel spreadsheet with delimited information (tracking #s) in various rows:
row a 630521*630621*630215*610517
row b 630522*630611
row c 630531*630651*630265
row d 630524
I would like to organize all rows of tracking #s, separated by a "*", into one column. Can you tell me how this is possible? I have 4,000+ rows like this with up to 21 tracking #s (variable) in each row that I want to convert to one column with multiple rows.
col a
630521
630621
630215
610517
630522
630611
630531
630651
630265
630524
You can do it all in Excel:
Highlight your column
On the Data menu, select Text to Columns => Delimited => Next => Other * => Finish
Then Copy/Paste each of the resultant columns into a single column and sort it to put the blanks at the bottom.
To save step 3. in Ron Smith's answer where you have a LOT of rows, you might add a blank row at the top and on the left, select you entire range (including all the blanks), apply the technique detailed here, delete the columns labelled Row and Column then filter to delete blank rows from column labelled Value.

Filter if one or another value is equal to cell

I need to solve one simple problem. I do have a one huge table that contains around 300000 rows with data and basically what I need is to filter out row if the cell in either G or L row is equal to cell in 'Input sheet'!C2.
Please see attached image.
So if the either G column or L column is containing value from cell then I want to copy entire row into sheet called 'Direct'. The 'Direct' will not contain empty rows.
As It is huge amount of data, that will grow a bit the code must be a bit optimized.
Many thanks in advance!!!
Cheers,
F.