excel


Excel : Substract Character Sets


We have two Columns A and B containing Industry codes and Excluded Industry code.
We need a third column C subtracting A and B.
Is There any formula to achieve this?
Industry |Excluded | Output
:------------------------------------------|:---------|:------
A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U | P,L,K,L | ?OUTPUT
------------------------------------------ |----------|------
A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U | P,L,K,L | ?OUTPUT
Try the following User Defined Function:
Public Function Remove(s1 As String, s2 As String) As String
Dim s As String
ary = Split(s2, ",")
s = Replace(Replace(s1, " ", Chr(1)), ",", " ")
For Each a In ary
s = Replace(s, a, "")
Next a
s = Application.WorksheetFunction.Trim(s)
Remove = Replace(Replace(s, " ", ","), Chr(1), " ")
End Function
User Defined Functions (UDFs) are very easy to install and use:
ALT-F11 brings up the VBE window
ALT-I
ALT-M opens a fresh module
paste the stuff in and close the VBE window
If you save the workbook, the UDF will be saved with it.
If you are using a version of Excel later then 2003, you must save
the file as .xlsm rather than .xlsx
To remove the UDF:
bring up the VBE window as above
clear the code out
close the VBE window
To use the UDF from Excel:
=remove(A1,B1)
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
and
http://msdn.microsoft.com/en-us/library/ee814735(v=office.14).aspx
and for specifics on UDFs, see:
http://www.cpearson.com/excel/WritingFunctionsInVBA.aspx
Macros must be enabled for this to work!

Related Links

Write vlookup function in excel vba
Combobox resets to first “blank” entry if cell on left is blank Error
I need to return a value that is not in the same row as the name [duplicate]
copy and paste including formats using VBA [duplicate]
How to conditional format based on the same cell changing value/override
Adding border to last used row via VBA?
VBA Excel How to replace a part of a value with another Cells value
Retrieving values from excel sheet based on key using macros Excel VBA
How to customize the Excel Function Wizard?
Evaluating effectively minutes per week in certain circumstances
Formula to extract numbers from a text string
Richfaces fileupload does not call listener
write data in excel using batch file
Naming a cell using VBA in excel
Transpose a range row
Get ORDERED SET with CUBESET function for multiple periods (OLAP)

Categories

HOME
node.js
react-native
momentjs
scadalts
highcharts
sitecore8
fiware
sharppcap
authorization
speech-recognition
import
post
webserver
jboss-eap-6
pstricks
aurelia-router
bluetooth-lowenergy
translate
apostrophe-cms
snapshot
jquery-gmap3
pyside
scons
indexof
hal
angular-openlayers
measurement
inversifyjs
protobuf-c
modeling
jquery-chosen
android-ffmpeg
vim-syntax-highlighting
sharethis
package-name
azure-virtual-machine
codeigniter-2
scada
sqlcmd
each
regedit
nonetype
sphero-api
android-optionsmenu
gemfile
mapped-drive
qnx
pywinusb
http-status-code-415
case-sensitive
tiles
wamp-protocol
coupling
gear-vr
opensmtpd
webpack-style-loader
oltp
android-build
vqmod
bubble-sort
optional
collaborative-filtering
asana-connect
leap-motion
canonical-link
android-image
imshow
code-collaborator
google-plus-domains
giflib
page-load-time
website-deployment
anthill
grid-layout
f#-interactive
angular-component-router
8085
jlist
android-context
elmah.mvc
xamarin-forms
unique-constraint
android-bundle
ontouchevent
zipcode
ncbi
jquery-dropkick
coderunner
gliffy
apache-tomee
ember.js-view
stacked-area-chart
worklight-server
controltemplate
n-tier
string-conversion
policies
rails-i18n
graphael
iron
interlacing
inference
gideros
tandem
slimv
windmill
batoo
ldapconnection
jquery-textext
ipad-2
jax-rpc
strtotime
function-overloading
kiln
iphone-3gs
set-include-path
blat

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile