VBA - Comparison Operator '<>' Not Working

DR RENO

Board Regular
Joined
Jun 29, 2018
Messages
65
I have two lines of code which are looking at the same dataset to pull in value found in col(P) based on the SUMIFS criteria. The top line is working correctly, as it's pulling in only the sum from "486". However the second line is ignoring ""<>&486"". This seems very straightforward, but for sum reason it is pulling in everything, meaning '0002337486' and every other acct number in data set. I've tried it without the & (ie. ""<>486"", and still no luck. Still learning VBA, so possibly there is something I'm doing wrong due to ignorance. Any help from one of you guys would be extremely appreciated.


Code:
.Cells(srow + 7, scol + 1) = "=SUMIFS('" & wsn & "'!$P$2:$P$1048576, '" & wsn & "'!$M$2:$M$1048576,Summary!$B$1,'" & wsn & "'!$N$2:$N$1048576,"">="" & '" & ws1n & "'!C$" & srow & ",'" & wsn & "'!$N$2:$N$1048576,""<=""&EOMONTH('" & ws1n & "'!C$" & srow & ",0),'" & wsn & "'!$B$2:$B$1048576,""486"")"
.Cells(srow + 8, scol + 1) = "=SUMIFS('" & wsn & "'!$P$2:$P$1048576, '" & wsn & "'!$M$2:$M$1048576,Summary!$B$1,'" & wsn & "'!$N$2:$N$1048576,"">="" & '" & ws1n & "'!C$" & srow & ",'" & wsn & "'!$N$2:$N$1048576,""<=""&EOMONTH('" & ws1n & "'!C$" & srow & ",0),'" & wsn & "'!$B$2:$B$1048576,""<>&486"")"
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
What do you have in column B, "486" or 486 or "0002337486"?



If you have "0002337486", then it could be like this:

""<>*486""
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top