Excel formula help

Please post any questions regarding the program here.

Moderator: 2020vision

Excel formula help

Postby mak » Mon May 24, 2010 9:37 am

if i have in cell a1 this

A) 2.15 2.45 3.15 3.45 4.15 4.45 5.15

how can i "write" a formula to have each number in different cells?

b1=2.15 -- c1=2.45 etr

thnx
mak
 
Posts: 1086
Joined: Tue Jun 30, 2009 8:17 am

Postby osknows » Mon May 24, 2010 10:06 am

For me the easiest way is to put this in a MODULE

Code: Select all
Function Sp(cell As Range, count As Integer)

If count <= UBound(Split(cell.Value, " ")) Then
Sp = Split(cell.Value, " ")(count)

Else

Sp = "Count greater than array size" ' change error accordingly

End If
End Function


Then in any cell the formula
=Sp(A1,0) would equal 2.15
=Sp(A1,1) equals 2.45

etc


If you wanted something you could copy and paste down without manually entering the count number then in cell B2 try
=sp($A$1,ROW(B2)-2)

the -2 must match the starting row so if you start at say row 6 formula would be =sp($A$1,ROW(B6)-6)
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby mak » Tue May 25, 2010 12:09 am

Os thanks it works fine.
I spend the entire day mostly trying to reformat (through formulas) the output of each cell

for example
2.15 = 1415 [ time -> without : ]
6.30 = 1830

I finally got it.Please out of curiosity & educative reasons, is it very hard to "write" a function about it?
mak
 
Posts: 1086
Joined: Tue Jun 30, 2009 8:17 am

Postby osknows » Tue May 25, 2010 7:23 am

Hi mak,

There's already an excel function call SUBSTITUTE

Eg

=SUBSTITUTE(A1,".","")

or using the earlier user function

=SUBSTITUTE(Sp(A1,0),".","")

I suppose if you really wanted to you could embeed it in earlier code

Code: Select all
Function Sp(cell As Range, count As Integer)

If count <= UBound(Split(cell.Value, " ")) Then
Sp = replace(Split(cell.Value, " ")(count) ,".","")

Else

Sp = "Count greater than array size" ' change error accordingly

End If
End Function
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby mak » Tue May 25, 2010 1:47 pm

Os
I used the SUBSTITUTE function the difficult thing was to replace 2 with 14
3 with 15 etr...
mak
 
Posts: 1086
Joined: Tue Jun 30, 2009 8:17 am

Postby osknows » Tue May 25, 2010 2:05 pm

Sorry Mak, I didn't read it properly. I thought you were just trying to omit the .

This could go in a MODULE
Code: Select all
Function ConvertTime(cell As Range)

ConvertTime = Split(cell.Value, ".")(0) + 12 & Split(cell.Value, ".")(1)

End Function


if A1 = 2.15

then =ConvertTime(A1)
= 1415
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby mak » Tue May 25, 2010 2:17 pm

Os i will try it later

* what a waste of my time
i have written 5 different formulas to achive this :(

Thanks :)
mak
 
Posts: 1086
Joined: Tue Jun 30, 2009 8:17 am


Return to Help

Who is online

Users browsing this forum: No registered users and 63 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.