ItalianPlatinum
Well-known Member
- Joined
- Mar 23, 2017
- Messages
- 893
- Office Version
- 365
- 2019
- Platform
- Windows
Hello - i am not very versed with index match but I am trying to put it to use because I need to lookup multiple conditions. I was able to put a formula together, then using VBA to apply the formula. But when I apply the formula it is putting @ signs in front of my ranges when it does that it causes #VALUE errors. If I remove them manually in the cell my formula operates. Do I have a problem with my formula or my VBA or both?
Formula: =INDEX('Trend'!$C$11:$C$5000,MATCH(0,('Trend'!$A$11:$A$5000=$A10)*('Trend'!$B$11:$B$5000=$D10),0))
Desired result:
Formula after VBA: =IF($R10<>"",INDEX('Trend'!C$11:C$5000,MATCH(0,(@'Trend'!$A$11:$A$5000=$A10)*(@'Trend'!$B$11:$B$5000=$D10),0)),VLOOKUP($D10,'Trend'!$B$11:$P$5000,COLUMNS($I$8:J$5000),0))
Formula: =INDEX('Trend'!$C$11:$C$5000,MATCH(0,('Trend'!$A$11:$A$5000=$A10)*('Trend'!$B$11:$B$5000=$D10),0))
Desired result:
5/29/2023 |
VBA Code:
.Range("I8:Q" & lastrow).Formula = "=IF($R8<>"""",INDEX('Trend'!C$11:C$5000,MATCH(0,('Trend'!$A$11:$A$5000=$A8)*('Trend'!$B$11:$B$5000=$D8),0)),VLOOKUP($D8,'Trend'!$B$11:$P$5000,COLUMNS($I$8:J$5000),0))"
Formula after VBA: =IF($R10<>"",INDEX('Trend'!C$11:C$5000,MATCH(0,(@'Trend'!$A$11:$A$5000=$A10)*(@'Trend'!$B$11:$B$5000=$D10),0)),VLOOKUP($D10,'Trend'!$B$11:$P$5000,COLUMNS($I$8:J$5000),0))
#VALUE! |