Can someone help me understand why my sumifs isn't working in vba?
up vote
0
down vote
favorite
I'm trying to code the following in VBA:
=SUMIFS(N2:N29,D2:D29,IF(COUNTIF(D2:D29,A36)=0,"*","="&A36),C2:C29,IF(COUNTIF(C2:C29,B36)=0,"*","="&B36),E2:E29,IF(COUNTIF(E2:E29,C36)=0,"*","="&C36),F2:F29,IF(COUNTIF(F2:F29,D36)=0,"*","="&D36))
The nested If and Countif are in there so that the Sumif ignores any condition that isn't required by the user (the user inputs A:B36), but still sums cells that meet all the remaining conditions.
I've written the following in vb (with criterias 1-3 determined in the same way):
If Application.WorksheetFunction.CountIf(Worksheets("Benchmark").Range("V" & i), Box4.Value) = 0 Then
criteria4 = "*"
Else
criteria4 = "=" & Box4.Value
End If
If criteria1 = "*" And criteria2 = "*" And criteria3 = "*" And criteria4 = "*" Then
dummy = 0
Else
dummy = Application.WorksheetFunction.SumIfs(Worksheets("Benchmark").Range("H" & i), Worksheets("Benchmark").Range("S" & i), criteria1, Worksheets("Benchmark") _
.Range("R" & i), criteria2, Worksheets("Benchmark").Range("C" & i), criteria3, Worksheets("Benchmark").Range("V" & i), criteria4)
but what is happening is that the sumifs
is summing all cells that meet at least one of the conditions supplied, rather than all of them...
Does anyone know where I'm going wrong? Appreciate that this is a bit of a convoluted question, hope it makes sense...
Edit: To add context, the purpose of this code is to loop through a range, and find cells that meet criteria supplied by the user. However, if the user opts to supply certain criteria but not others, then those criteria not supplied are ignored. I've used a sumifs because my understanding is that the function will sum all cells that meet the set of criteria supplied. I can then say, if sumifs>0 then cell meets criteria supplied by the user
excel vba excel-vba sumifs
|
show 9 more comments
up vote
0
down vote
favorite
I'm trying to code the following in VBA:
=SUMIFS(N2:N29,D2:D29,IF(COUNTIF(D2:D29,A36)=0,"*","="&A36),C2:C29,IF(COUNTIF(C2:C29,B36)=0,"*","="&B36),E2:E29,IF(COUNTIF(E2:E29,C36)=0,"*","="&C36),F2:F29,IF(COUNTIF(F2:F29,D36)=0,"*","="&D36))
The nested If and Countif are in there so that the Sumif ignores any condition that isn't required by the user (the user inputs A:B36), but still sums cells that meet all the remaining conditions.
I've written the following in vb (with criterias 1-3 determined in the same way):
If Application.WorksheetFunction.CountIf(Worksheets("Benchmark").Range("V" & i), Box4.Value) = 0 Then
criteria4 = "*"
Else
criteria4 = "=" & Box4.Value
End If
If criteria1 = "*" And criteria2 = "*" And criteria3 = "*" And criteria4 = "*" Then
dummy = 0
Else
dummy = Application.WorksheetFunction.SumIfs(Worksheets("Benchmark").Range("H" & i), Worksheets("Benchmark").Range("S" & i), criteria1, Worksheets("Benchmark") _
.Range("R" & i), criteria2, Worksheets("Benchmark").Range("C" & i), criteria3, Worksheets("Benchmark").Range("V" & i), criteria4)
but what is happening is that the sumifs
is summing all cells that meet at least one of the conditions supplied, rather than all of them...
Does anyone know where I'm going wrong? Appreciate that this is a bit of a convoluted question, hope it makes sense...
Edit: To add context, the purpose of this code is to loop through a range, and find cells that meet criteria supplied by the user. However, if the user opts to supply certain criteria but not others, then those criteria not supplied are ignored. I've used a sumifs because my understanding is that the function will sum all cells that meet the set of criteria supplied. I can then say, if sumifs>0 then cell meets criteria supplied by the user
excel vba excel-vba sumifs
1
Just checking: Have you tried using the formula without the VBA to check that the formula itself is working as expected?
– Mistella
Nov 19 at 12:42
Hi Mistella - Thanks for replying. Yes I have, it works fine in the spreadsheet...
– Jerbs
Nov 19 at 12:44
Where are you settingi
? Is it a single number, or part of a range (e.g."3:H10"
)?
– Chronocidal
Nov 19 at 12:46
So what I've posted is nested within a for loop, for i = 2 to LastRow
– Jerbs
Nov 19 at 12:48
Also - your Excel and VBA formula are pointing to completely different columns? Is this deliberate, or have you mis-posted one of them?
– Chronocidal
Nov 19 at 12:52
|
show 9 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to code the following in VBA:
=SUMIFS(N2:N29,D2:D29,IF(COUNTIF(D2:D29,A36)=0,"*","="&A36),C2:C29,IF(COUNTIF(C2:C29,B36)=0,"*","="&B36),E2:E29,IF(COUNTIF(E2:E29,C36)=0,"*","="&C36),F2:F29,IF(COUNTIF(F2:F29,D36)=0,"*","="&D36))
The nested If and Countif are in there so that the Sumif ignores any condition that isn't required by the user (the user inputs A:B36), but still sums cells that meet all the remaining conditions.
I've written the following in vb (with criterias 1-3 determined in the same way):
If Application.WorksheetFunction.CountIf(Worksheets("Benchmark").Range("V" & i), Box4.Value) = 0 Then
criteria4 = "*"
Else
criteria4 = "=" & Box4.Value
End If
If criteria1 = "*" And criteria2 = "*" And criteria3 = "*" And criteria4 = "*" Then
dummy = 0
Else
dummy = Application.WorksheetFunction.SumIfs(Worksheets("Benchmark").Range("H" & i), Worksheets("Benchmark").Range("S" & i), criteria1, Worksheets("Benchmark") _
.Range("R" & i), criteria2, Worksheets("Benchmark").Range("C" & i), criteria3, Worksheets("Benchmark").Range("V" & i), criteria4)
but what is happening is that the sumifs
is summing all cells that meet at least one of the conditions supplied, rather than all of them...
Does anyone know where I'm going wrong? Appreciate that this is a bit of a convoluted question, hope it makes sense...
Edit: To add context, the purpose of this code is to loop through a range, and find cells that meet criteria supplied by the user. However, if the user opts to supply certain criteria but not others, then those criteria not supplied are ignored. I've used a sumifs because my understanding is that the function will sum all cells that meet the set of criteria supplied. I can then say, if sumifs>0 then cell meets criteria supplied by the user
excel vba excel-vba sumifs
I'm trying to code the following in VBA:
=SUMIFS(N2:N29,D2:D29,IF(COUNTIF(D2:D29,A36)=0,"*","="&A36),C2:C29,IF(COUNTIF(C2:C29,B36)=0,"*","="&B36),E2:E29,IF(COUNTIF(E2:E29,C36)=0,"*","="&C36),F2:F29,IF(COUNTIF(F2:F29,D36)=0,"*","="&D36))
The nested If and Countif are in there so that the Sumif ignores any condition that isn't required by the user (the user inputs A:B36), but still sums cells that meet all the remaining conditions.
I've written the following in vb (with criterias 1-3 determined in the same way):
If Application.WorksheetFunction.CountIf(Worksheets("Benchmark").Range("V" & i), Box4.Value) = 0 Then
criteria4 = "*"
Else
criteria4 = "=" & Box4.Value
End If
If criteria1 = "*" And criteria2 = "*" And criteria3 = "*" And criteria4 = "*" Then
dummy = 0
Else
dummy = Application.WorksheetFunction.SumIfs(Worksheets("Benchmark").Range("H" & i), Worksheets("Benchmark").Range("S" & i), criteria1, Worksheets("Benchmark") _
.Range("R" & i), criteria2, Worksheets("Benchmark").Range("C" & i), criteria3, Worksheets("Benchmark").Range("V" & i), criteria4)
but what is happening is that the sumifs
is summing all cells that meet at least one of the conditions supplied, rather than all of them...
Does anyone know where I'm going wrong? Appreciate that this is a bit of a convoluted question, hope it makes sense...
Edit: To add context, the purpose of this code is to loop through a range, and find cells that meet criteria supplied by the user. However, if the user opts to supply certain criteria but not others, then those criteria not supplied are ignored. I've used a sumifs because my understanding is that the function will sum all cells that meet the set of criteria supplied. I can then say, if sumifs>0 then cell meets criteria supplied by the user
excel vba excel-vba sumifs
excel vba excel-vba sumifs
edited Nov 19 at 12:53
asked Nov 19 at 12:38
Jerbs
63
63
1
Just checking: Have you tried using the formula without the VBA to check that the formula itself is working as expected?
– Mistella
Nov 19 at 12:42
Hi Mistella - Thanks for replying. Yes I have, it works fine in the spreadsheet...
– Jerbs
Nov 19 at 12:44
Where are you settingi
? Is it a single number, or part of a range (e.g."3:H10"
)?
– Chronocidal
Nov 19 at 12:46
So what I've posted is nested within a for loop, for i = 2 to LastRow
– Jerbs
Nov 19 at 12:48
Also - your Excel and VBA formula are pointing to completely different columns? Is this deliberate, or have you mis-posted one of them?
– Chronocidal
Nov 19 at 12:52
|
show 9 more comments
1
Just checking: Have you tried using the formula without the VBA to check that the formula itself is working as expected?
– Mistella
Nov 19 at 12:42
Hi Mistella - Thanks for replying. Yes I have, it works fine in the spreadsheet...
– Jerbs
Nov 19 at 12:44
Where are you settingi
? Is it a single number, or part of a range (e.g."3:H10"
)?
– Chronocidal
Nov 19 at 12:46
So what I've posted is nested within a for loop, for i = 2 to LastRow
– Jerbs
Nov 19 at 12:48
Also - your Excel and VBA formula are pointing to completely different columns? Is this deliberate, or have you mis-posted one of them?
– Chronocidal
Nov 19 at 12:52
1
1
Just checking: Have you tried using the formula without the VBA to check that the formula itself is working as expected?
– Mistella
Nov 19 at 12:42
Just checking: Have you tried using the formula without the VBA to check that the formula itself is working as expected?
– Mistella
Nov 19 at 12:42
Hi Mistella - Thanks for replying. Yes I have, it works fine in the spreadsheet...
– Jerbs
Nov 19 at 12:44
Hi Mistella - Thanks for replying. Yes I have, it works fine in the spreadsheet...
– Jerbs
Nov 19 at 12:44
Where are you setting
i
? Is it a single number, or part of a range (e.g. "3:H10"
)?– Chronocidal
Nov 19 at 12:46
Where are you setting
i
? Is it a single number, or part of a range (e.g. "3:H10"
)?– Chronocidal
Nov 19 at 12:46
So what I've posted is nested within a for loop, for i = 2 to LastRow
– Jerbs
Nov 19 at 12:48
So what I've posted is nested within a for loop, for i = 2 to LastRow
– Jerbs
Nov 19 at 12:48
Also - your Excel and VBA formula are pointing to completely different columns? Is this deliberate, or have you mis-posted one of them?
– Chronocidal
Nov 19 at 12:52
Also - your Excel and VBA formula are pointing to completely different columns? Is this deliberate, or have you mis-posted one of them?
– Chronocidal
Nov 19 at 12:52
|
show 9 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
Here is a version bodged together based on additional information garnered through the comments, that dispenses with the SumIfs
entirely:
Dim dummy AS Long, IsValid AS Boolean
For i = 2 to LastRow
If Box1.Value & Box2.Value & Box2.Value & Box4.Value = "****" Then
dummy = 0
Else
IsValid = (Worksheets("Benchmark").Cells(i, "S").Value LIKE Box1.Value)
IsValid = IsValid And (Worksheets("Benchmark").Cells(i, "R").Value LIKE Box2.Value)
IsValid = IsValid And (Worksheets("Benchmark").Cells(i, "C").Value LIKE Box3.Value)
IsValid = IsValid And (Worksheets("Benchmark").Cells(i, "V").Value LIKE Box4.Value)
If IsValid Then
dummy = Worksheets("Benchmark").Cells(i, "H").Value
Else
dummy = 0
End If
End If
'Code to do stuff with dummy goes here
Next i
For each iteration of the For
loop, we are using a Boolean variable to track if the row is valid, and LIKE
statements to check each criteria. The 2nd comparison onwards use AND
to make sure that you remember if the criteria has already failed.
A LIKE
statement is similar to an =
statement, but allows Wildcards - so, for example "SomeText" = "SomeOtherText"
and "SomeText" LIKE "SomeOtherText"
will both be False
, whereas "Some*Text" = "SomeOtherText"
will be False
while "Some*Text" LIKE "SomeOtherText"
will be True
- since the "*"
means "any text can go here".
(SumIfs
uses a LIKE
comparison instead of an =
comparison, unless you specifically specify =
at the start of the Condition.)
Thanks for taking the time to write this. Just so I understand correctly, will this code only check for criteria that are supplied by the user? And ignore any that aren't supplied?
– Jerbs
Nov 19 at 13:37
So I suppose there are two things; the code has to ignore any conditions not supplied by the user, and only evaluate as True if all conditions that are supplied are satisfied
– Jerbs
Nov 19 at 13:44
@Jerbs If theBox#.Value
is"*"
when the user has not specified a criteria, then that check will automatically evaluate asTrue
(sinceVariable LIKE "*"
means "Variable is anything, including an empty string") unless your variable contains an error code. (In which case, you will get a "Type Mismatch" error)
– Chronocidal
Nov 19 at 15:44
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Here is a version bodged together based on additional information garnered through the comments, that dispenses with the SumIfs
entirely:
Dim dummy AS Long, IsValid AS Boolean
For i = 2 to LastRow
If Box1.Value & Box2.Value & Box2.Value & Box4.Value = "****" Then
dummy = 0
Else
IsValid = (Worksheets("Benchmark").Cells(i, "S").Value LIKE Box1.Value)
IsValid = IsValid And (Worksheets("Benchmark").Cells(i, "R").Value LIKE Box2.Value)
IsValid = IsValid And (Worksheets("Benchmark").Cells(i, "C").Value LIKE Box3.Value)
IsValid = IsValid And (Worksheets("Benchmark").Cells(i, "V").Value LIKE Box4.Value)
If IsValid Then
dummy = Worksheets("Benchmark").Cells(i, "H").Value
Else
dummy = 0
End If
End If
'Code to do stuff with dummy goes here
Next i
For each iteration of the For
loop, we are using a Boolean variable to track if the row is valid, and LIKE
statements to check each criteria. The 2nd comparison onwards use AND
to make sure that you remember if the criteria has already failed.
A LIKE
statement is similar to an =
statement, but allows Wildcards - so, for example "SomeText" = "SomeOtherText"
and "SomeText" LIKE "SomeOtherText"
will both be False
, whereas "Some*Text" = "SomeOtherText"
will be False
while "Some*Text" LIKE "SomeOtherText"
will be True
- since the "*"
means "any text can go here".
(SumIfs
uses a LIKE
comparison instead of an =
comparison, unless you specifically specify =
at the start of the Condition.)
Thanks for taking the time to write this. Just so I understand correctly, will this code only check for criteria that are supplied by the user? And ignore any that aren't supplied?
– Jerbs
Nov 19 at 13:37
So I suppose there are two things; the code has to ignore any conditions not supplied by the user, and only evaluate as True if all conditions that are supplied are satisfied
– Jerbs
Nov 19 at 13:44
@Jerbs If theBox#.Value
is"*"
when the user has not specified a criteria, then that check will automatically evaluate asTrue
(sinceVariable LIKE "*"
means "Variable is anything, including an empty string") unless your variable contains an error code. (In which case, you will get a "Type Mismatch" error)
– Chronocidal
Nov 19 at 15:44
add a comment |
up vote
0
down vote
Here is a version bodged together based on additional information garnered through the comments, that dispenses with the SumIfs
entirely:
Dim dummy AS Long, IsValid AS Boolean
For i = 2 to LastRow
If Box1.Value & Box2.Value & Box2.Value & Box4.Value = "****" Then
dummy = 0
Else
IsValid = (Worksheets("Benchmark").Cells(i, "S").Value LIKE Box1.Value)
IsValid = IsValid And (Worksheets("Benchmark").Cells(i, "R").Value LIKE Box2.Value)
IsValid = IsValid And (Worksheets("Benchmark").Cells(i, "C").Value LIKE Box3.Value)
IsValid = IsValid And (Worksheets("Benchmark").Cells(i, "V").Value LIKE Box4.Value)
If IsValid Then
dummy = Worksheets("Benchmark").Cells(i, "H").Value
Else
dummy = 0
End If
End If
'Code to do stuff with dummy goes here
Next i
For each iteration of the For
loop, we are using a Boolean variable to track if the row is valid, and LIKE
statements to check each criteria. The 2nd comparison onwards use AND
to make sure that you remember if the criteria has already failed.
A LIKE
statement is similar to an =
statement, but allows Wildcards - so, for example "SomeText" = "SomeOtherText"
and "SomeText" LIKE "SomeOtherText"
will both be False
, whereas "Some*Text" = "SomeOtherText"
will be False
while "Some*Text" LIKE "SomeOtherText"
will be True
- since the "*"
means "any text can go here".
(SumIfs
uses a LIKE
comparison instead of an =
comparison, unless you specifically specify =
at the start of the Condition.)
Thanks for taking the time to write this. Just so I understand correctly, will this code only check for criteria that are supplied by the user? And ignore any that aren't supplied?
– Jerbs
Nov 19 at 13:37
So I suppose there are two things; the code has to ignore any conditions not supplied by the user, and only evaluate as True if all conditions that are supplied are satisfied
– Jerbs
Nov 19 at 13:44
@Jerbs If theBox#.Value
is"*"
when the user has not specified a criteria, then that check will automatically evaluate asTrue
(sinceVariable LIKE "*"
means "Variable is anything, including an empty string") unless your variable contains an error code. (In which case, you will get a "Type Mismatch" error)
– Chronocidal
Nov 19 at 15:44
add a comment |
up vote
0
down vote
up vote
0
down vote
Here is a version bodged together based on additional information garnered through the comments, that dispenses with the SumIfs
entirely:
Dim dummy AS Long, IsValid AS Boolean
For i = 2 to LastRow
If Box1.Value & Box2.Value & Box2.Value & Box4.Value = "****" Then
dummy = 0
Else
IsValid = (Worksheets("Benchmark").Cells(i, "S").Value LIKE Box1.Value)
IsValid = IsValid And (Worksheets("Benchmark").Cells(i, "R").Value LIKE Box2.Value)
IsValid = IsValid And (Worksheets("Benchmark").Cells(i, "C").Value LIKE Box3.Value)
IsValid = IsValid And (Worksheets("Benchmark").Cells(i, "V").Value LIKE Box4.Value)
If IsValid Then
dummy = Worksheets("Benchmark").Cells(i, "H").Value
Else
dummy = 0
End If
End If
'Code to do stuff with dummy goes here
Next i
For each iteration of the For
loop, we are using a Boolean variable to track if the row is valid, and LIKE
statements to check each criteria. The 2nd comparison onwards use AND
to make sure that you remember if the criteria has already failed.
A LIKE
statement is similar to an =
statement, but allows Wildcards - so, for example "SomeText" = "SomeOtherText"
and "SomeText" LIKE "SomeOtherText"
will both be False
, whereas "Some*Text" = "SomeOtherText"
will be False
while "Some*Text" LIKE "SomeOtherText"
will be True
- since the "*"
means "any text can go here".
(SumIfs
uses a LIKE
comparison instead of an =
comparison, unless you specifically specify =
at the start of the Condition.)
Here is a version bodged together based on additional information garnered through the comments, that dispenses with the SumIfs
entirely:
Dim dummy AS Long, IsValid AS Boolean
For i = 2 to LastRow
If Box1.Value & Box2.Value & Box2.Value & Box4.Value = "****" Then
dummy = 0
Else
IsValid = (Worksheets("Benchmark").Cells(i, "S").Value LIKE Box1.Value)
IsValid = IsValid And (Worksheets("Benchmark").Cells(i, "R").Value LIKE Box2.Value)
IsValid = IsValid And (Worksheets("Benchmark").Cells(i, "C").Value LIKE Box3.Value)
IsValid = IsValid And (Worksheets("Benchmark").Cells(i, "V").Value LIKE Box4.Value)
If IsValid Then
dummy = Worksheets("Benchmark").Cells(i, "H").Value
Else
dummy = 0
End If
End If
'Code to do stuff with dummy goes here
Next i
For each iteration of the For
loop, we are using a Boolean variable to track if the row is valid, and LIKE
statements to check each criteria. The 2nd comparison onwards use AND
to make sure that you remember if the criteria has already failed.
A LIKE
statement is similar to an =
statement, but allows Wildcards - so, for example "SomeText" = "SomeOtherText"
and "SomeText" LIKE "SomeOtherText"
will both be False
, whereas "Some*Text" = "SomeOtherText"
will be False
while "Some*Text" LIKE "SomeOtherText"
will be True
- since the "*"
means "any text can go here".
(SumIfs
uses a LIKE
comparison instead of an =
comparison, unless you specifically specify =
at the start of the Condition.)
answered Nov 19 at 13:23
Chronocidal
2,5301216
2,5301216
Thanks for taking the time to write this. Just so I understand correctly, will this code only check for criteria that are supplied by the user? And ignore any that aren't supplied?
– Jerbs
Nov 19 at 13:37
So I suppose there are two things; the code has to ignore any conditions not supplied by the user, and only evaluate as True if all conditions that are supplied are satisfied
– Jerbs
Nov 19 at 13:44
@Jerbs If theBox#.Value
is"*"
when the user has not specified a criteria, then that check will automatically evaluate asTrue
(sinceVariable LIKE "*"
means "Variable is anything, including an empty string") unless your variable contains an error code. (In which case, you will get a "Type Mismatch" error)
– Chronocidal
Nov 19 at 15:44
add a comment |
Thanks for taking the time to write this. Just so I understand correctly, will this code only check for criteria that are supplied by the user? And ignore any that aren't supplied?
– Jerbs
Nov 19 at 13:37
So I suppose there are two things; the code has to ignore any conditions not supplied by the user, and only evaluate as True if all conditions that are supplied are satisfied
– Jerbs
Nov 19 at 13:44
@Jerbs If theBox#.Value
is"*"
when the user has not specified a criteria, then that check will automatically evaluate asTrue
(sinceVariable LIKE "*"
means "Variable is anything, including an empty string") unless your variable contains an error code. (In which case, you will get a "Type Mismatch" error)
– Chronocidal
Nov 19 at 15:44
Thanks for taking the time to write this. Just so I understand correctly, will this code only check for criteria that are supplied by the user? And ignore any that aren't supplied?
– Jerbs
Nov 19 at 13:37
Thanks for taking the time to write this. Just so I understand correctly, will this code only check for criteria that are supplied by the user? And ignore any that aren't supplied?
– Jerbs
Nov 19 at 13:37
So I suppose there are two things; the code has to ignore any conditions not supplied by the user, and only evaluate as True if all conditions that are supplied are satisfied
– Jerbs
Nov 19 at 13:44
So I suppose there are two things; the code has to ignore any conditions not supplied by the user, and only evaluate as True if all conditions that are supplied are satisfied
– Jerbs
Nov 19 at 13:44
@Jerbs If the
Box#.Value
is "*"
when the user has not specified a criteria, then that check will automatically evaluate as True
(since Variable LIKE "*"
means "Variable is anything, including an empty string") unless your variable contains an error code. (In which case, you will get a "Type Mismatch" error)– Chronocidal
Nov 19 at 15:44
@Jerbs If the
Box#.Value
is "*"
when the user has not specified a criteria, then that check will automatically evaluate as True
(since Variable LIKE "*"
means "Variable is anything, including an empty string") unless your variable contains an error code. (In which case, you will get a "Type Mismatch" error)– Chronocidal
Nov 19 at 15:44
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53374841%2fcan-someone-help-me-understand-why-my-sumifs-isnt-working-in-vba%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Just checking: Have you tried using the formula without the VBA to check that the formula itself is working as expected?
– Mistella
Nov 19 at 12:42
Hi Mistella - Thanks for replying. Yes I have, it works fine in the spreadsheet...
– Jerbs
Nov 19 at 12:44
Where are you setting
i
? Is it a single number, or part of a range (e.g."3:H10"
)?– Chronocidal
Nov 19 at 12:46
So what I've posted is nested within a for loop, for i = 2 to LastRow
– Jerbs
Nov 19 at 12:48
Also - your Excel and VBA formula are pointing to completely different columns? Is this deliberate, or have you mis-posted one of them?
– Chronocidal
Nov 19 at 12:52