Anbuselvam K
Member
Hi
The below formula I tried to convert VBA code but I struck how I can tell VBA that between two dates and only in sales data to be extracted.
IF(P1=EN2,(SUMPRODUCT((J8:J30495<=EN1)*(J8:J30495>=EO1)*(G8:G30495="Sales")*CF8:CF30495))
Cell J8: J30495 is sales date
Cell G8: G30495 is having sales and free sample
Cell CF8: CF30495 having the value of Production cost (Need to sum up)
EN1 and EO1 is the start and end date (04-Mar-2018 and 10-Oct-2018)
The code is
After getting the activecell.value equals to EN2, How do I get CF column sum value, between the dates in J column and only sales in G column?
Expecting your valuable reply.
The below formula I tried to convert VBA code but I struck how I can tell VBA that between two dates and only in sales data to be extracted.
IF(P1=EN2,(SUMPRODUCT((J8:J30495<=EN1)*(J8:J30495>=EO1)*(G8:G30495="Sales")*CF8:CF30495))
Cell J8: J30495 is sales date
Cell G8: G30495 is having sales and free sample
Cell CF8: CF30495 having the value of Production cost (Need to sum up)
EN1 and EO1 is the start and end date (04-Mar-2018 and 10-Oct-2018)
The code is
Code:
Sub sumdatabetweendates()
Dim ProductionCost As Long
Dim SalesDate As Long
Worksheets("Master Data").Select
Range("P1").Select
ProductionCost = Range("CF8:CF30000")
SalesDate = Range("J8:J30000")
If ActiveCell.Value = Range("EN2") Then
ProductionCost = sum range("CF8:CF30000).value
End Sub
After getting the activecell.value equals to EN2, How do I get CF column sum value, between the dates in J column and only sales in G column?
Expecting your valuable reply.
Last edited by a moderator: