excelbytes
Active Member
- Joined
- Dec 11, 2014
- Messages
- 251
- Office Version
- 365
- Platform
- Windows
I have two or three SUMIFS that I need to add together into one cell using VBA. An example of two formulas I need to add together (data is in tables):
Range("B7").Select
ActiveCell.FormulaR1C1 = _
"=SUMIFS(PeticionesTable[Efectivo],PeticionesTable[Fecha de entrega (mes/dia/año)],"">=""&R1C2,PeticionesTable[Fecha de entrega (mes/dia/año)],""<=""&R2C2,PeticionesTable[Línea estratégica],RC[-1])"
SUM with this:
"=SUMIFS(PeticionesTable[Especie],PeticionesTable[Fecha de entrega (mes/dia/año)],"">=""&R1C2,PeticionesTable[Fecha de entrega (mes/dia/año)],""<=""&R2C2,PeticionesTable[Línea estratégica],RC[-1])"
As you can see, all the criteria is the same, the only difference is the sum_range. How do I combine these into one formula?
Range("B7").Select
ActiveCell.FormulaR1C1 = _
"=SUMIFS(PeticionesTable[Efectivo],PeticionesTable[Fecha de entrega (mes/dia/año)],"">=""&R1C2,PeticionesTable[Fecha de entrega (mes/dia/año)],""<=""&R2C2,PeticionesTable[Línea estratégica],RC[-1])"
SUM with this:
"=SUMIFS(PeticionesTable[Especie],PeticionesTable[Fecha de entrega (mes/dia/año)],"">=""&R1C2,PeticionesTable[Fecha de entrega (mes/dia/año)],""<=""&R2C2,PeticionesTable[Línea estratégica],RC[-1])"
As you can see, all the criteria is the same, the only difference is the sum_range. How do I combine these into one formula?