Update value in a column from another worksheet depending on the date in a range (1 Viewer)

raghuprabhu

Registered User.
Local time
Today, 15:26
Joined
Mar 24, 2008
Messages
154
Our new pay system at work went live in August 2017.
This is the new pay calendar (called PayPeriods)
Start Date End Date Pay period
10 Aug 17 23 Aug 17 PP0001
24 Aug 17 06 Sep 17 PP0002
07 Sep 17 20 Sep 17 PP0003
21 Sep 17 04 Oct 17 PP0004
05 Oct 17 18 Oct 17 PP0005
19 Oct 17 01 Nov 17 PP0006

This is the table for members (called MemberList)
Name Due Date Amount Processed in Pay Cal
Raghu 15 Jul 17 $248.00 PP0001
Vim 20 Jul 17 $354.00 PP0001
Abhi 10 Aug 17 $954.00 PP0001
Neelima 23 Aug 17 $134.00 PP0001
Raghu 14 Sep 17 $134.00 PP0003
Vim 21 Sep 17 $524.00 PP0004
Abhi 06 Oct 17 $332.00 PP0005
Neelima 20 Oct17 $158.00 PP0006
Raghu 06 Sep16 $456.00 PP0002
Vim 19 Sep 17 $159.00 PP0003
Abhi 03 Oct 17 $357.00 PP0004
Neelima 18 Oct 17 $852.00 PP0005

I want to update the Processed in Pay Cal column with the pay periods.

Anything with a due date on or 23 AUG 17 to be processed in PP0001 and the rest in the appropriate pay calendar. I need help with the code to write a macro.
Code:
Sub updateColunm4()
If duedate <= 23Aug17 then
	Update column 4 to PP0001
Else
	Update column 4 to the appropriate pay period
End if
End sub
Thank you

Regards
Raghu
 
Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 23:26
Joined
Sep 21, 2011
Messages
14,238
No need for macro.

Look at SUMPRODUCT

I do something simliar for values between two dates.

Look at columns K & L in sheets Gas or Electric in the attached workbook.

HTH
 

Attachments

  • Utils.xls
    114 KB · Views: 259

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:26
Joined
May 7, 2009
Messages
19,229
U can also use a simple If() and SumIfs().
 

raghuprabhu

Registered User.
Local time
Today, 15:26
Joined
Mar 24, 2008
Messages
154
thanks

arnelgp and Gasman.
Code:
Sub updateColunm4()
If duedate <= 23Aug17 then
	Update column 4 to PP0001
Else
	Update column 4 to the appropriate pay period
End if
End sub

arnelgp I can to the if bit, how do I do the else bit?

Thanks

Raghu
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:26
Joined
May 7, 2009
Messages
19,229
See the formula at Memberlist Sheet.
 

Attachments

  • Book1.xlsx
    13.6 KB · Views: 264

Users who are viewing this thread

Top Bottom