Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
on 10th August 08 asked for help to sum first number in a range of
cells,Hector came up with this Set myrange1 = Range(Selection.EntireRow.Cells(1, 1), Selection) MsgBox Evaluate("sumproduct(--left(0&" & myrange1.Address & ",2))") And it works a treat, but I have been trying madly to get it to work using the second letter in a cell in the range as a criterea for the sum to work. Please Help or I shall start smoking again. Regards John L |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You need to use MID instead of Left to get the middle of a string. Mid
requires the start position of the character and the number of characters. Set myrange1 = Range(Selection.EntireRow.Cells(1, 1), Selection) MsgBox Evaluate("sumproduct(--mid(0&" & myrange1.Address & ",1,1))") "John LR" wrote: on 10th August 08 asked for help to sum first number in a range of cells,Hector came up with this Set myrange1 = Range(Selection.EntireRow.Cells(1, 1), Selection) MsgBox Evaluate("sumproduct(--left(0&" & myrange1.Address & ",2))") And it works a treat, but I have been trying madly to get it to work using the second letter in a cell in the range as a criterea for the sum to work. Please Help or I shall start smoking again. Regards John L |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the answer Joel'
What I am trying to do is sum the left single number in a cell in a range , by using the mid(2,1) in the same cell as the criteria, eg if myrange1 cells contain 2a.4a.5b. and the criteria is "a" then the answer is 6 "Joel" wrote: You need to use MID instead of Left to get the middle of a string. Mid requires the start position of the character and the number of characters. Set myrange1 = Range(Selection.EntireRow.Cells(1, 1), Selection) MsgBox Evaluate("sumproduct(--mid(0&" & myrange1.Address & ",1,1))") "John LR" wrote: on 10th August 08 asked for help to sum first number in a range of cells,Hector came up with this Set myrange1 = Range(Selection.EntireRow.Cells(1, 1), Selection) MsgBox Evaluate("sumproduct(--left(0&" & myrange1.Address & ",2))") And it works a treat, but I have been trying madly to get it to work using the second letter in a cell in the range as a criterea for the sum to work. Please Help or I shall start smoking again. Regards John L |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Max number in a given range | New Users to Excel | |||
"PasteSpecial method of Range class failed" when range Number of Rows 2000 | Excel Programming | |||
Locate number within range, copy number below it to another cell | Excel Programming | |||
Finding Number Within Range Then Copying Data Below Number to Cells | Excel Programming | |||
Assign one number to a number range | New Users to Excel |