Find the column by name and to sum that column

GirishDhruva

Active Member
Joined
Mar 26, 2019
Messages
308
Hi everyone i am posting for 1st time in MrExcel, Help me to solve this.
Here is the table.
[TABLE="width: 299"]
<colgroup><col><col><col span="3"></colgroup><tbody>[TR]
[TD]Apple[/TD]
[TD]Ball[/TD]
[TD]Cat[/TD]
[TD]Dog[/TD]
[TD]Elephant[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]432[/TD]
[TD="align: right"]34324[/TD]
[TD="align: right"]544[/TD]
[TD="align: right"]366[/TD]
[/TR]
</tbody>[/TABLE]
From the above table i need to find "Ball" and sum that column and that should be shown in a particular cell in VBA
 
You're welco.
Please find comments in code
Code:
Sub GirishDhruva()
   Dim Nxt As Long
   Dim Hdr As String
   Nxt = Cells(1, Columns.Count).End(xlToLeft).Offset(, 1).Column    ' Finds the first blank column based on row 1
   Hdr = Range(Cells(1, 1), Cells(1, Nxt - 1)).Address(, , xlR1C1)   ' assigns the address of A1 to the last used column in row 1 to the variable Hdr
   Range(Cells(2, Nxt), Cells(Rows.Count, Nxt - 1).End(xlUp).Offset(, 1)).FormulaR1C1 = "=SUMPRODUCT((" & Hdr & "=""Basic"")+(" & Hdr & "=""HRA"")+(" & Hdr & "=""PF""),(rc1:rc[-1]))" ' inserts the formula into the first blank column
End Sub
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
ActiveCell.FormulaR1C1 = "=SUM(RC[-19]:RC[-15],RC[-10]:RC[-9])"
Instead of this can i select the column with the column names and add their values
where i need to add the cells individually like,Sum of Arrears-Basic+Sum of Basic+Sum of Arrears+HouseRentAllowance+Sum of HouseRentAllowance+Sum of ChildrenEducationAllowance+Sum of Other Earnings+Sum of Other Earnings Non Taxable, all this sum should come in last column with the column name as "Salary"[TABLE="width: 3879"]
<tbody>[TR]
[TD]

[/TD]
[/TR]
</tbody>[/TABLE]


[TABLE="width: 3879"]
<colgroup><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col span="3"></colgroup><tbody>[TR]
[TD]Row Labels[/TD]
[TD]Sum of Arrears-Basic[/TD]
[TD]Sum of Basic[/TD]
[TD]Sum of Arrears-HouseRentAllowance[/TD]
[TD]Sum of HouseRentAllowance[/TD]
[TD]Sum of ChildrenEducationAllowance[/TD]
[TD]Sum of Arrears-NPS EMPLOYER EARNING 80CCD2[/TD]
[TD]Sum of NPS EMPLOYER EARNING 80CCD2[/TD]
[TD]Sum of Other Earnings[/TD]
[TD]Sum of Other Earnings Non Taxable[/TD]
[TD]Sum of Arrears-Other Allowance[/TD]
[TD]Sum of Other Allowance[/TD]
[TD]Sum of ProvidentFund[/TD]
[TD]Sum of ProfessionalTax[/TD]
[TD]Sum of Employees StateInsurance[/TD]
[TD]Sum of Lunch Deduction[/TD]
[TD]Sum of IncomeTax[/TD]
[TD]Sum of Parental Medical Deduction[/TD]
[TD]Sum of NPS EMPLOYER DEDUCTION80CCD2[/TD]
[TD]Sum of Net Payment[/TD]
[TD]Salary[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]1100[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]112718[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]56360[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]2023[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]142898[/TD]
[TD="align: right"]13525[/TD]
[TD="align: right"]624[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]990[/TD]
[TD="align: right"]1527[/TD]
[TD="align: right"]1283[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]296050[/TD]
[TD="align: right"]311976[/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]1103[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]149235[/TD]
[TD="align: right"]-1[/TD]
[TD="align: right"]74618[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]16527[/TD]
[TD="align: right"]12838[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]3677[/TD]
[TD="align: right"]-16523[/TD]
[TD="align: right"]166828[/TD]
[TD="align: right"]17908[/TD]
[TD="align: right"]416[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]330[/TD]
[TD="align: right"]34623[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]29365[/TD]
[TD="align: right"]324658[/TD]
[TD="align: right"]374258[/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]1104[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]43646[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]21824[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]3842[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]51774[/TD]
[TD="align: right"]5237[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]5695[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]110154[/TD]
[TD="align: right"]117244[/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]1106[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]13173[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]6587[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]3725[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]11631[/TD]
[TD="align: right"]1581[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]33535[/TD]
[TD="align: right"]31391[/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]1110[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]361027[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]180514[/TD]
[TD="align: right"]400[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]21902[/TD]
[TD="align: right"]8958[/TD]
[TD="align: right"]12365[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]409170[/TD]
[TD="align: right"]43322[/TD]
[TD="align: right"]1456[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1848[/TD]
[TD="align: right"]123544[/TD]
[TD="align: right"]1804[/TD]
[TD="align: right"]21902[/TD]
[TD="align: right"]800466[/TD]
[TD="align: right"]951117[/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]1112[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]116898[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]58449[/TD]
[TD="align: right"]200[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]3367[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]122129[/TD]
[TD="align: right"]14027[/TD]
[TD="align: right"]624[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]990[/TD]
[TD="align: right"]49345[/TD]
[TD="align: right"]1184[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]234873[/TD]
[TD="align: right"]297676[/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]1113[/TD]
[TD="align: right"]-1[/TD]
[TD="align: right"]210299[/TD]
[TD="align: right"]-4[/TD]
[TD="align: right"]105149[/TD]
[TD="align: right"]300[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]7284[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]4426[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]255232[/TD]
[TD="align: right"]25235[/TD]
[TD="align: right"]832[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1320[/TD]
[TD="align: right"]62814[/TD]
[TD="align: right"]1496[/TD]
[TD="align: right"]7284[/TD]
[TD="align: right"]483704[/TD]
[TD="align: right"]570975[/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]1114[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]161683[/TD]
[TD="align: right"]-2[/TD]
[TD="align: right"]80843[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]4000[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]199318[/TD]
[TD="align: right"]19402[/TD]
[TD="align: right"]208[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]198[/TD]
[TD="align: right"]67868[/TD]
[TD="align: right"]1314[/TD]
[TD="align: right"]4000[/TD]
[TD="align: right"]352960[/TD]
[TD="align: right"]441950[/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]1115[/TD]
[TD="align: right"]-1[/TD]
[TD="align: right"]397089[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]177399[/TD]
[TD="align: right"]200[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]8633[/TD]
[TD="align: right"]4350[/TD]
[TD="align: right"]8914[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]242989[/TD]
[TD="align: right"]47649[/TD]
[TD="align: right"]4784[/TD]
[TD="align: right"]3268[/TD]
[TD="align: right"]8160[/TD]
[TD="align: right"]65958[/TD]
[TD="align: right"]1292[/TD]
[TD="align: right"]8633[/TD]
[TD="align: right"]699831[/TD]
[TD="align: right"]817678[/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]1119[/TD]
[TD="align: right"]5441[/TD]
[TD="align: right"]433183[/TD]
[TD="align: right"]2722[/TD]
[TD="align: right"]216593[/TD]
[TD="align: right"]600[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]4294[/TD]
[TD="align: right"]8333[/TD]
[TD="align: right"]13504[/TD]
[TD="align: right"]7258[/TD]
[TD="align: right"]522848[/TD]
[TD="align: right"]47742[/TD]
[TD="align: right"]416[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]660[/TD]
[TD="align: right"]120870[/TD]
[TD="align: right"]2312[/TD]
[TD="align: right"]4294[/TD]
[TD="align: right"]1038482[/TD]
[TD="align: right"]1188645[/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]1120[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]175762[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]87881[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]354[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]218697[/TD]
[TD="align: right"]21091[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]173411[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]288192[/TD]
[TD="align: right"]482340[/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]

[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
For the above question, If those columns are available then it should sum else it should skip those columns and sum the remaining columns.
Thanks in prior
 
Last edited:
Upvote 0
How to find the sum of particular column
1.Need to search for that column name
2.Then should find the sum of that column in last+1 cell of that column

From the below table i need to find the sum of "Sum of ProvidentFund","Sum of ProfesssionalTax","Sum of IncomeTax"
[TABLE="width: 3815"]
<tbody>[TR]
[TD]Row Labels[/TD]
[TD]Sum of Arrears-Basic[/TD]
[TD]Sum of Basic[/TD]
[TD]Sum of Arrears-HouseRentAllowance[/TD]
[TD]Sum of HouseRentAllowance[/TD]
[TD]Sum of ChildrenEducationAllowance[/TD]
[TD]Sum of Arrears-NPS EMPLOYER EARNING 80CCD2[/TD]
[TD]Sum of NPS EMPLOYER EARNING 80CCD2[/TD]
[TD]Sum of Other Earnings[/TD]
[TD]Sum of Other Earnings Non Taxable[/TD]
[TD]Sum of Arrears-Other Allowance[/TD]
[TD]Sum of Other Allowance[/TD]
[TD]Sum of ProvidentFund[/TD]
[TD]Sum of ProfessionalTax[/TD]
[TD]Sum of Employees StateInsurance[/TD]
[TD]Sum of Lunch Deduction[/TD]
[TD]Sum of IncomeTax[/TD]
[TD]Sum of Parental Medical Deduction[/TD]
[TD]Sum of NPS EMPLOYER DEDUCTION80CCD2[/TD]
[TD]Sum of Net Payment[/TD]
[TD]Salary[/TD]
[TD]NPS[/TD]
[/TR]
[TR]
[TD="align: right"]1100[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]112718[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]56360[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]2023[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]142898[/TD]
[TD="align: right"]13525[/TD]
[TD="align: right"]624[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]990[/TD]
[TD="align: right"]1527[/TD]
[TD="align: right"]1283[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]296050[/TD]
[TD="align: right"]311976[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD="align: right"]1103[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]149235[/TD]
[TD="align: right"]-1[/TD]
[TD="align: right"]74618[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]16527[/TD]
[TD="align: right"]12838[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]3677[/TD]
[TD="align: right"]-16523[/TD]
[TD="align: right"]166828[/TD]
[TD="align: right"]17908[/TD]
[TD="align: right"]416[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]330[/TD]
[TD="align: right"]34623[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]29365[/TD]
[TD="align: right"]324658[/TD]
[TD="align: right"]374258[/TD]
[TD="align: right"]29365[/TD]
[/TR]
[TR]
[TD="align: right"]1104[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]43646[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]21824[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]3842[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]51774[/TD]
[TD="align: right"]5237[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]5695[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]110154[/TD]
[TD="align: right"]117244[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD="align: right"]1106[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]13173[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]6587[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]3725[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]11631[/TD]
[TD="align: right"]1581[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]33535[/TD]
[TD="align: right"]31391[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD="align: right"]1110[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]361027[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]180514[/TD]
[TD="align: right"]400[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]21902[/TD]
[TD="align: right"]8958[/TD]
[TD="align: right"]12365[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]409170[/TD]
[TD="align: right"]43322[/TD]
[TD="align: right"]1456[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1848[/TD]
[TD="align: right"]123544[/TD]
[TD="align: right"]1804[/TD]
[TD="align: right"]21902[/TD]
[TD="align: right"]800466[/TD]
[TD="align: right"]951117[/TD]
[TD="align: right"]21902[/TD]
[/TR]
[TR]
[TD="align: right"]1112[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]116898[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]58449[/TD]
[TD="align: right"]200[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]3367[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]122129[/TD]
[TD="align: right"]14027[/TD]
[TD="align: right"]624[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]990[/TD]
[TD="align: right"]49345[/TD]
[TD="align: right"]1184[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]234873[/TD]
[TD="align: right"]297676[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD="align: right"]1113[/TD]
[TD="align: right"]-1[/TD]
[TD="align: right"]210299[/TD]
[TD="align: right"]-4[/TD]
[TD="align: right"]105149[/TD]
[TD="align: right"]300[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]7284[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]4426[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]255232[/TD]
[TD="align: right"]25235[/TD]
[TD="align: right"]832[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1320[/TD]
[TD="align: right"]62814[/TD]
[TD="align: right"]1496[/TD]
[TD="align: right"]7284[/TD]
[TD="align: right"]483704[/TD]
[TD="align: right"]570975[/TD]
[TD="align: right"]7284[/TD]
[/TR]
[TR]
[TD="align: right"]1114[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]161683[/TD]
[TD="align: right"]-2[/TD]
[TD="align: right"]80843[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]4000[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]199318[/TD]
[TD="align: right"]19402[/TD]
[TD="align: right"]208[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]198[/TD]
[TD="align: right"]67868[/TD]
[TD="align: right"]1314[/TD]
[TD="align: right"]4000[/TD]
[TD="align: right"]352960[/TD]
[TD="align: right"]441950[/TD]
[TD="align: right"]4000[/TD]
[/TR]
[TR]
[TD="align: right"]1115[/TD]
[TD="align: right"]-1[/TD]
[TD="align: right"]397089[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]177399[/TD]
[TD="align: right"]200[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]8633[/TD]
[TD="align: right"]4350[/TD]
[TD="align: right"]8914[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]242989[/TD]
[TD="align: right"]47649[/TD]
[TD="align: right"]4784[/TD]
[TD="align: right"]3268[/TD]
[TD="align: right"]8160[/TD]
[TD="align: right"]65958[/TD]
[TD="align: right"]1292[/TD]
[TD="align: right"]8633[/TD]
[TD="align: right"]699831[/TD]
[TD="align: right"]817678[/TD]
[TD="align: right"]8633[/TD]
[/TR]
[TR]
[TD="align: right"]1119[/TD]
[TD="align: right"]5441[/TD]
[TD="align: right"]433183[/TD]
[TD="align: right"]2722[/TD]
[TD="align: right"]216593[/TD]
[TD="align: right"]600[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]4294[/TD]
[TD="align: right"]8333[/TD]
[TD="align: right"]13504[/TD]
[TD="align: right"]7258[/TD]
[TD="align: right"]522848[/TD]
[TD="align: right"]47742[/TD]
[TD="align: right"]416[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]660[/TD]
[TD="align: right"]120870[/TD]
[TD="align: right"]2312[/TD]
[TD="align: right"]4294[/TD]
[TD="align: right"]1038482[/TD]
[TD="align: right"]1188645[/TD]
[TD="align: right"]4294[/TD]
[/TR]
[TR]
[TD="align: right"]1120[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]175762[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]87881[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]354[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]218697[/TD]
[TD="align: right"]21091[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]173411[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]288192[/TD]
[TD="align: right"]482340[/TD]
[TD="align: right"]0[/TD]
[/TR]
</tbody>[/TABLE]


Thanks in Prior
 
Last edited:
Upvote 0
Hi Everyone,
I am very poor in coding and some one can solve this and explain me the code , till now i have done this.

Sub sumcol()
Dim sh As Worksheet
Dim Fnd As Range
Set sh = Sheets("Sheet1")
Set Fnd = sh.Rows(1).Find("Basic", , xlValues, xlWhole)
If Not Fnd Is Nothing Then
'"code for sum(Basic) and sum should be present at last ROW"
Else
MsgBox "Search Item Not Found!"
Exit Sub
End If
End Sub

Thank you in advance
 
Upvote 0
Hi Everyone,
I tried this code to sum a particular column by finding its column name
Code:
Sub sumcol()
    Dim sh As Worksheet
    Dim Fnd As Range
    Dim c As Long
    Dim lr As Long
    Set sh = Sheets("Sheet1")
    Set Fnd = sh.Rows(1).Find("Basic", , xlValues, xlWhole)
    lr = Fnd.Cells(Fnd.Rows.Count, 1).End(xlUp).Row
    If Not Fnd Is Nothing Then
        Fnd.Cells(lr + 1, 0).Formula = "=SUM(" & Fnd.Range(Fnd.Cells(2, 0), Fnd.Cells(lr, 0)).Address & ")"
    Else
        MsgBox "Search Item Not Found!"
        Exit Sub
    End If
End Sub

But it's throwing me error can i know what wrong i have done in this code

Thank You in advance
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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