Forum Discussion
RobG92
Jun 20, 2018Copper Contributor
In a column of Data, Find 2nd, 3rd, nth occurrences and apply a value in the corresponding column
Hi all, Attached is a spreadsheet that gives an example of what I'm working with. In it, I'm trying to create a formula that searches all of column F for the exact same tag numbers. And if it...
JKPieterse
Jun 21, 2018Silver Contributor
Place this formula in cell I2 and copy down:
=IF(COUNTIF(F$1:F1,F2)>0,"Again","")
=IF(COUNTIF(F$1:F1,F2)>0,"Again","")
RobG92
Jun 21, 2018Copper Contributor
This is great!
But how can I apply it in Macro/VBA?
It seems to be failing.
My friend stated I may need to do R1C1??
But how can I apply it in Macro/VBA?
It seems to be failing.
My friend stated I may need to do R1C1??
- JKPieterseJun 22, 2018Silver Contributor
The VBA syntax to add this to cell I2:
Range("I2").Formula = "=IF(COUNTIF(F$1:F1,F2)>0,""Again"","""")"
Note the doubled-up quotes.
- RobG92Jun 29, 2018Copper ContributorI'm not an expert by any means in Excel Macros/VBA. We just had an existing Macro and I was hoping to manipulate it to do this for us.
We need it to copy and paste in the column but what you provided isn't working...not sure If I'm doing it right or not- JKPieterseJun 30, 2018Silver ContributorBest if you explain what it is needs doing, what my code does which is undesirable and also show what code you already have and where it needs adjusting.