PDA

View Full Version : Compare two sets of data with multiple conditions



Nyeknyok
06-30-2020, 08:12 AM
Hi I am trying to compare two sets of data by having indicators if they increased, decreased, or stayed the same.

Something like this:
If D6 = J6 then K6.Value = 0
If D6 > J6 then K6.Value = 1
If D6 < J6 then K6.Value = 2

I got it working with this:


For i = 0 To (ProgramCount * 2 - 1) Step 2
With rng.Offset(, i + 4)
.FormulaR1C1 = "=IF('Sheet2'!RC[-1]='Sheet1'!RC[-1],0,IF('Sheet2'!RC[-1]>'Sheet1'!RC[-1],1,2))"
.Value2 = .Value2
End With
Next​

but I got stuck, since I wanted to add a condition that if the word "NULL" or "/" appears on a cell then it would do the opposite.
I've tried adding another IF condition to the formula but I couldn't make it work.

26893

Thank you in advance!