Find the column by name and copy those values (divided/12)

GirishDhruva

Active Member
Joined
Mar 26, 2019
Messages
308
Hi everyone,
Below i have attached table , from which i need to search for a column through column name and when it finds that column it should perform some tasks like
1.It should divide by 12 from all the values which are found
2.Only that column should be copied and pasted in another new sheet with "Total at the bottom of that column"

BasicHRAPFPTESI
123354232345412343
12341343234524234512354
12354313451143251345514
3513454345543154345543
534455134545321451345
31453245413454353235231
5432455423542534541362354
1432364136436142334564
423451234546143623446354

<tbody>
</tbody>

Thank you in advance
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi everyone,
Below i have attached table , from which i need to search for a column through column name and when it finds that column it should perform some tasks like
1.It should divide by 12 from all the values which are found
2.Only that column should be copied and pasted in another new sheet with "Total at the bottom of that column"

BasicHRAPFPTESI
123354232345412343
12341343234524234512354
12354313451143251345514
3513454345543154345543
534455134545321451345
31453245413454353235231
5432455423542534541362354
1432364136436142334564
423451234546143623446354

<tbody>
</tbody>

Thank you in advance

Now i just need to sum that column ,which is divided by 12

Code:
Sub sum()
Dim sh As Worksheet
Dim Fnd As Range
Dim Nxt As Long
Dim Hdr As String
    Set sh = Sheets("Sheet2")
    Set Fnd = sh.Rows(3).Find("Basic", , xlValues, xlWhole)
    If Not Fnd Is Nothing Then
        Nxt = Cells(4, Columns.Count).End(xlToLeft).Offset(, 1).Column
        Hdr = Range(Cells(3, 1), Cells(3, Nxt - 1)).Address(, , xlR1C1)
        Range(Cells(4, Nxt), Cells(Rows.Count, Nxt - 1).End(xlUp).Offset(, 1)).FormulaR1C1 = "=SUMPRODUCT((" & Hdr & "=""Basic"")/12,(rc1:rc[-1]))"
        
    Else
        MsgBox "Search Item Not Found!"
        Exit Sub
    End If
End Sub

Thank you in advance
 
Upvote 0

Forum statistics

Threads
1,215,004
Messages
6,122,656
Members
449,091
Latest member
peppernaut

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