vba Loop every row to extract out the last third columns

Mi Dan 25 Reputation points
2023-02-11T07:41:48.7733333+00:00

Dear all,

I need help to extract from excel with huge number of row records (100K+) and columns from A to AP.

Every row last used cell appears in different columns

pic5

  1. Extract 2nd last used columns such as higlighted: ACERecruit, FINANCE, IAP, SPORTS into 1 new column
  2. Extract from 2nd column till last used 2nd column (concat join) such as:
  • View or Edit will be the last column in every row.
  • Expected 1 new column should return:

[For IG Support] Nominations for Overseas Developmental Programmes in 2022
2009S77 Claim ( Disbursement ) IAP
TDF01 / LEV3 / 221 - Gastro Beats 2000 - 2010

Many thanks ❤ struggling for awhile, well appreciated any help :))

Microsoft 365 and Office Excel For business Windows
Developer technologies VB
0 comments No comments
{count} votes

Accepted answer
  1. Nobuko Ichimaru 316 Reputation points
    2023-02-12T06:51:02.54+00:00

    各行抽出 2023-02-12 154150

    look forward to helping you even a little.

    Assuming that there are no spaces until the last column of each row,

    Enter the following formula in the AQ2 cell.

    =TEXTJOIN(" ",,B2:(INDIRECT(ADDRESS(ROW(B2),COUNTA(A2:AP2)-2))))

    The display should look like this:

    [For IG Support] Nominations for Overseas Developmental Programs in 2022

    Copy the AQ2 cell

    Select the last row of AQ (same as the last row of column B) to AQ3 and press ent.

    you can batch paste.

    Copy the AQ column

    Paste the value on another sheet.


1 additional answer

Sort by: Most helpful
  1. Mi Dan 25 Reputation points
    2023-02-12T10:45:38.21+00:00

    hihi this solves the concatenation and is able to extract on an individual row basis.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.