dear grand masters
i have one more doubt about the follwing
cell a1 is some digits
cell b1 my cutting digits
cell c1 result
i don''t want the cell b1 digits in my result(cell c1)
only the balance number from cell a1 is in cell c1
any one help
thank you for all of your great support
Last edited by sun_ilkumar; 12-15-2009 at 04:23 PM.
In your other thread here:
http://www.excelforum.com/excel-new-...m-a-group.html
You asked the same question and I provided a UDF that is ready to go and works.
For your workbook above, put the dashes BACK in B1 so that it reads 2-4-6-7 and the UDF which you were already given will continue to work for you.
I'm hoping your next question is not a variation of the same thing again.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
sir
both are different books
first book is ok and working perfectly,
but the second case is enterly different from the first one
both i attached with this one
the difference is the result
first one i need that numbers in the result
second one i don't want that numbers in result
hope you understand me
Let's use the same UDF for both functions. Here's the code:
I've added a third parameter, it is now used like so:Code:Option Explicit Function STRINGTEST(RNG As Range, RNG2 As Range, Excl As Boolean) 'JBeaucaire (12/15/2009) Dim MyArr, MyArr2, buf As String, Fnd As Boolean Dim i As Long, j As Long, Cnt As Long MyArr = Split(Application.WorksheetFunction.Substitute(RNG.Value, Chr(10), "-"), "-") MyArr2 = Split(RNG2.Value, "-") For i = 0 To UBound(MyArr) For j = 0 To UBound(MyArr2) If InStr(MyArr(i), MyArr2(j)) Then Fnd = True Exit For End If Next j If (Fnd And Not Excl) Or (Not Fnd And Excl) Then buf = buf & MyArr(i) & "-" Cnt = Cnt + 4 End If If Cnt = 40 Then buf = Left(buf, Len(buf) - 1) & Chr(10) Cnt = 0 End If Fnd = False Next i Do If Right(buf, 1) = "-" Then buf = Left(buf, Len(buf) - 1) Else STRINGTEST = buf Exit Do End If Loop End Function
=STRINGTEST(A2, B2, FALSE)
First parameter is the cell with the - separated values to test
Second parameter is the cell with the - separated digits to include/exclude
Third parameter is FALSE to include the digits in the second parameter, is TRUE to exclude them.
Last edited by JBeaucaire; 12-15-2009 at 04:07 PM. Reason: Major bug fixed. Should work now.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
thank you big boss
![]()
Code above has had a major bug fixed in the logic. It should work now.
=========
If that takes care of your need, be sure to EDIT your original post, click Go Advanced and mark the PREFIX box [SOLVED].
(Also, use the blue "scales" icon in our posts to leave Reputation Feedback, it is appreciated. It is found across from the "time" in each of our posts.)
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks