vba help please

shyamvinjamuri

Board Regular
Joined
Aug 2, 2006
Messages
175
split a name into first and last name based on upper and lower case.
eg. JohnDoe to read as John Doe.

Please help
Thanks
 
I fiddled around with it some, and there is probably a shorter way to do this, but the below options work.

Excel Workbook
ABC
1JohnDoeJohnDoe
2MikeWilfordMikeWilford
3JaniceDoeJaniceDoe
4MichaelWilfordMichaelWilford
5JohnDoeJohnDoe
6MikeWilfordMikeWilford
7JaniceDoeJaniceDoe
8MichaelWilfordMichaelWilford
Sheet2
Excel 2007
#VALUE!
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}. Note: Do not try and enter these manually yourself

2 quick questions


=LEFT(A1,MAX(IF(CODE(MID(A1,ROW(INDIRECT("A1:A"&LEN(A1))),1))<=90, IF(CODE(MID(A1,ROW(INDIRECT("A1:A"&LEN(A1))),1))>=60,ROW(INDIRECT("A1:A"&LEN(A1))),0)))-1)

=LEFT($A3,SUMPRODUCT(--(CODE(MID($A3,ROW(INDIRECT("A1:A"&LEN($A3))),1))<=90)*--(CODE(MID($A3,ROW(INDIRECT("A1:A"&LEN($A3))),1))>=60)*(ROW(INDIRECT("A1:A"&LEN($A3)))))-2)


You used Sumproduct function and Max function, is this just another way of doing it or can't you just use the same code as above 1st or 2nd code all the way copied down?

2. Why do you need the second part of the formula?
IF(CODE(MID(A1,ROW(INDIRECT("A1:A"&LEN(A1))),1))>=60

The formula work fine without this part, Are you doing this for any particular reason?

THANK YOU
 
Upvote 0

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.
1. I did it two different ways as an example, though you should pick a preferred way to go and stick with it for an entire column. In excel (as with almost anything) you can do things alot of different ways. There are usually better ways to do things though I don't think there is a big difference in the the 2 examples that I have.

2. the second part ensures that I find and split with a capital letter and not a non capital letter or symbol of some kind. If you know exactly what you're going to get data wise, you can simplify the formula, though this one is built to handle a wider variety of data. Also, with a wider variety of data that you would have to handle, the formula would get more complicated and you're probably better off trying to clean up your data in some way first or switching to vba to handle it.
 
Upvote 0

Forum statistics

Threads
1,224,550
Messages
6,179,463
Members
452,915
Latest member
hannnahheileen

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