Vba help

Isabella

Well-known Member
Joined
Nov 7, 2008
Messages
643
Hi,

Is there a macro that will return the abbrev in Col B under the heading "Rec" by looking at the mapping in Col J & K?

Excel Workbook
BCDEFGHIJK
1RecAccountAccountAbbrev
2SMPNCSX.GESBEQGOLDSMP
3SMPNCSX.BENWEBNCSXSMP
4SMPNCSX.GESBESTATSMP
5SMPNCSX.GESSUBSXSMP
6SMPUBSX.SMPSPEMIRXMIR ASIA
7SMPABNA.HOOGOVJPMCSMP
8SMPABNA.HOOGOVDIATSMP
9BNPPINTLBNPP.ABAAOFBNPPBNPPINTL
10NZACLEARAIAU40AMPWNZACLEAR
11NTCONZEXTERNAL
12AMP.FUTURESFUTURES
13AIAU40NZACLEAR
14AIEO40NZACLEAR
15AIFB40NZACLEAR
16AIFG40NZACLEAR
17AIFN40NZACLEAR
18
Sheet2
 
The code fails on Exigo

Excel Workbook
BCDEFGHIJK
1RecAccountAccountAbbrev
2SMPNCSX.GESBEQGOLDSMP
3SMPNCSX.BENWEBNCSXSMP
4SMPNCSX.GESBESTATSMP
5SMPNCSX.GESSUBSXSMP
6SMPUBSX.SMPSPEMIRXMIR ASIA
7SMPABNA.HOOGOVJPMCSMP
8SMPABNA.HOOGOVDIATSMP
9BNPPINTLBNPP.ABAAOFBNPPBNPPINTL
10NZACLEARAIAU40AMPWNZACLEAR
11N/AEXIG.COGN20NTCONZEXTERNAL
12N/AEXIG.COGNINAMP.FUTURESFUTURES
13N/AEXIG.AMPS20AIAU40NZACLEAR
14N/AAIEO40NZACLEAR
15N/AAIFB40NZACLEAR
16N/AAIFG40NZACLEAR
17N/AAIFN40NZACLEAR
18N/AABNASMP
19EXIG.COGN20NOM EXIGO
20EXIG.COGNINNOM EXIGO
21EXIG.AMPS20LIFE EXIGO
22
Sheet2
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Isabella,

The macro I posted on reply #9 will yield:


Excel Workbook
BCDEFGHIJK
1RecAccountAccountAbbrev
2SMPNCSX.GESBEQGOLDSMP
3SMPNCSX.BENWEBNCSXSMP
4SMPNCSX.GESBESTATSMP
5SMPNCSX.GESSUBSXSMP
6SMPUBSX.SMPSPEMIRXMIR ASIA
7SMPABNA.HOOGOVJPMCSMP
8SMPABNA.HOOGOVDIATSMP
9BNPPINTLBNPP.ABAAOFBNPPBNPPINTL
10NZACLEARAIAU40AMPWNZACLEAR
11IsabellaNTCONZEXTERNAL
12NOM EXIGOEXIG.COGN20AMP.FUTURESFUTURES
13NOM EXIGOEXIG.COGNINAIAU40NZACLEAR
14LIFE EXIGOEXIG.AMPS20AIEO40NZACLEAR
15AIFB40NZACLEAR
16AIFG40NZACLEAR
17AIFN40NZACLEAR
18ABNASMP
19EXIG.COGN20NOM EXIGO
20EXIG.COGNINNOM EXIGO
21EXIG.AMPS20LIFE EXIGO
22
Sheet2
 
Last edited:
Upvote 0
Hi peter that works but how do i get rid of the N/A in col b?
From your results it would indicate that there is something in column C in those rows but I can't see what it is. However, surely you can see the part of my code that returns "N/A" and try modifying that yourself. ;)


The code fails on Exigo
This comes back to the questions asked by rudfaden in posts #2 and #4 which were never clearly answered. Until you posted this new data that my code fails on, I guessed that the "mapping" was that you looked up in column J what came before the "." (if there was one) in column C and returned the corresponding value from column K. I must admit I hadn't fully considered the "AMP.FUTURES" entry in column J but no examples of that were given.

So what is the logic behind what is to be returned?
How do we know whether just to check the first part of column C or the whole of it?

Hiker's code may be just what you are after but note that it may return incorrect results if and entry like "NCSX.ABNA" was possible in column C. Would that be possible?

Do you have a comprehensive list of all possible values and their abbreviations for columns J:K? If it isn't too long, could we see it?

Similarly, is there comprehensive list of possible values for column C?

Note also that the post #8 code seems to work for any of the data you have posted so far (provided the colummn J & K range in the formula is extended to be big enough for the data)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,487
Members
452,917
Latest member
MrsMSalt

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