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

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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