If you were looking for a VBA solution, you should've posted in the Programming forum...
We'll see if someone with VBA skills will join and add a suggestion.
If you were looking for a VBA solution, you should've posted in the Programming forum...
We'll see if someone with VBA skills will join and add a suggestion.
Where there is a will there are many ways.
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Good afternoon dsexpress
For clarification - are you wanting to extract each number from the string in a cell?
What are you hoping to compare them to?
DominicB
Please familiarise yourself with the rules before posting. You can find them here.
I just want to get the first number: eg
289/345/896 result would be integer 289
23/45 " " integer 23
684/234/123/456 ' '' integer 684
I am then comparing this value to a sum of numbers in a collection of cells
Thanks
Hi dsexpress
This code will do what you want, but in the absence of guidance from yourself, it will take its value from A1, and subtract from that the sum of values in range B1:B10, and then display the result in a MsgBox :
HTH![]()
Sub test() Dim Ex As Long, Tot As Long Ex = Left(Range("A1").Value, InStr(1, Range("A1").Value, "/") - 1) Tot = Application.WorksheetFunction.Sum(Range("B1:B10")) MsgBox Ex - Tot End Sub
DominicB
Yes, thanks
That helps with the extraction. I just need to test the cell for contents of "/". I am going to assume the find function?
Hi dsexpress
I'm not sure what you mean. Do you want to test first whether the cell contains a "/"? If so what do you want to do if a "/" isn't found?Originally Posted by dsexpress
If I've got it totally wrong and am barking up the wrong tree, explain to me exactly what you mean.
DominicB
I appreciate your patience. Ill try by example:
For i = 1 to 17
If cells(i,"G").value = ( 234/45/67 (value with "/") ) then flag=1
a= a+cells(i,"K").value
next i
Case flag=1
if a<>234 then color cells(i,"G").value (First Number only) red
I hope thats better
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks