Why does this code sometimes not work?

tjak

Board Regular
Joined
Jan 2, 2003
Messages
117
This code is not being correctly read on a consistent basis and I don't know why. Somedays the alpha split is correct, and somedays, "Barb" gets alpha starting at "J" and sometimes starting at "M". The first split ("Jill") consistently is correct. When "Barb" is wrong, it throws off "Julie".

Can anyone tell me why the "Barb" split is not getting correctly processed
every time?
Is it the code? Is my XL corrupted? Or?

Range("d2").Select
ActiveCell.Formula = "=If(g2>2500,""BETTY"",If(a2<""G"",""JILL"",If(A2>""M"",""BARB"",""JULIE"")))"
Range("d2").Select
Selection.AutoFill Destination:=Range("D2:d" & LastRow)

Thanx.
 

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.
I can't - they're customer names. Privacy laws.
I'm not sure what you're looking for, so maybe some background will do?

I download the report each day. I've never noticed that any of the names start with a blank space (they all look aligned). All caps. They would look like: SMITH,JOHNR.

Today, "Barb" started at the M's. Yesterday, the split started with the J's. The previous 6 days, all was correct. That's when I started with this module.

Does any of this help?
 
Upvote 0
There must be something at the start of the cell that's greater than M. A space isn't.

If you aren't willing to share the problem name, what does

=CODE(LEFT(TheCellWithTheProblemName))

return?
 
Upvote 0
"77" ,when the name in the cell starts "MABL....." (This from today's report.)
This signifies what?
 
Upvote 0
The alpha split should be:
A - F "Jill"
G - M "Julie"
N - Z "Barb"

That's the rub - until 2 days ago, I got the correct alpha split from the code. Now something has gone wrong, but I haven't changed the code. Barb shouldn't start until "N".
 
Upvote 0
Well if you put MABL in A1 and M in A2 and sort A1:A2 ascending, the order will be reversed. So "MABL" is greater than "M".

What you probably need is:

If(LEFT(A2)>""M"",""BARB"",""JULIE"")
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,803
Members
449,048
Latest member
greyangel23

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