Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-12-2018, 01:05 AM
mpapreja mpapreja is offline Salary Structure Calculations Windows 10 Salary Structure Calculations Office 2016
Novice
Salary Structure Calculations
 
Join Date: May 2018
Posts: 9
mpapreja is on a distinguished road
Default

Quote:
Originally Posted by mpapreja View Post
can somebody give me a macro only for calculating basic, hra, bonus and pf atleast?

I have achieved the desired results with following MACRO for the simplest case i.e. it is calculating Basic, HRA, Bonus, EPF, ESIC. I need to refine this code (make it more simple and efficient) and apply the same logic for calculating Conv., Med., CCA and SPA Values. There is one more problem, this code only works when i make changes in cell O8 (increment %) and press tab. if i use left, upper or down arrow the code doesnot work. the code should work as soon as there is a change in cell O8. Can somebody help me in this regard?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$O$8" Then



Dim NewCTC As Double
Dim GrossIncrease As Integer
Dim NewBasic As Double
Dim NewBonus As Double
Dim EPF As Double
Dim FinalCTC As Double

Dim TakeHome As Double
FinalCTC = 0

NewCTC = ActiveCell.Previous.Offset(0, -1).Value + (ActiveCell.Previous.Offset(0, -1).Value) * ActiveCell.Previous.Value
GrossIncrease = NewCTC - ActiveCell.Previous.Offset(0, -1).Value
ActiveCell.Previous.Offset(0, 1).Value = NewCTC
ActiveCell.Previous.Offset(0, 2).Value = GrossIncrease

'New Basic Start
Select Case ActiveCell.Previous.Offset(0, -13).Value
Case 1
NewBasic = WorksheetFunction.Max(NewCTC * 0.26, 9200)
Case 2
NewBasic = WorksheetFunction.Max(NewCTC * 0.26, 8200)
Case 3
NewBasic = WorksheetFunction.Max(NewCTC * 0.26, 7800)
End Select
ActiveCell.Previous.Offset(0, 3).Value = NewBasic
'New Basic End


'New Bonus Start
NewBonus = NewBasic * 0.2
ActiveCell.Previous.Offset(0, 10).Value = NewBonus
'New Bonus End

'New EPF Start
NewEPF = NewBasic * 0.12
ActiveCell.Previous.Offset(0, 11).Value = NewEPF
'New EPF End


'FOR Freezing HRA Value - New HRA+ESIC Start
NewHRA = NewBasic * 0.5
NewTakeHome = NewBasic + NewHRA
If NewTakeHome < 21000 Then
NewESIC = NewTakeHome * 0.0425
Else
NewESIC = 0
End If
FinalCTC = NewBasic + NewHRA + NewBonus + NewEPF + NewESIC
If FinalCTC > NewCTC Then
Do While (Round(FinalCTC, 0) <> Round(NewCTC, 0))
NewHRA = NewHRA - 1
NewTakeHome = NewBasic + NewHRA
If NewTakeHome < 21000 Then
NewESIC = NewTakeHome * 0.0425
Else
NewESIC = 0
End If
FinalCTC = NewBasic + NewHRA + NewBonus + NewEPF + NewESIC
If NewHRA = 0 Then
Exit Do
End If
Loop
End If
ActiveCell.Previous.Offset(0, 4).Value = Round(NewHRA, 0)
ActiveCell.Previous.Offset(0, 12).Value = Round(NewESIC, 0)
ActiveCell.Previous.Offset(0, 13).Value = Round(FinalCTC, 0)
'New HRA+ESIC End








End If
End Sub
Reply With Quote
Reply

Tags
basic, salary, structure



Similar Threads
Thread Thread Starter Forum Replies Last Post
Document structure PetrK Word 2 05-12-2017 07:25 AM
Salary Structure Calculations Calculating the “total” based on “salary” value and its “type” (multiple IF), Jamal NUMAN Excel 4 07-05-2016 12:34 AM
Salary Structure Calculations Structure chart jenny p PowerPoint 1 02-24-2016 09:14 AM
VLookup formula Problem (salary plus (commission x sales)) topgear2015 Excel 11 06-05-2013 09:02 PM
How to add more tel nos to contacts structure plainman007 Outlook 0 03-16-2010 02:16 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:05 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft