View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Terry Pinnell[_4_] Terry Pinnell[_4_] is offline
external usenet poster
 
Posts: 192
Default Stripping out text?


GS wrote:

Of course.., you'll need to change the $A1 ref to suit your sheet layout:

Assuming header row
=IF(RIGHT($G2,2)="GB",LEFT($G2,4)/1,LEFT($G2,4)/1000)


Brilliant, thanks Garry, works a treat!

I'm wondering if it would be possible to avoid that 'helper' column?

https://www.dropbox.com/s/guvjbe1kg8...ula-1.jpg?dl=0

Or even go further and edit the VBA code (which I kindly received from
an Excel web forum) to deliver the output in that numerical format
directly? That's my preference after realising that I would sometimes
need to SUM various cells. To complete the picture, here's the code:

Public Function GetFileSize(rngcell As Range) As String
Const PROP_FILE As Long = 1
flAddress = rngcell.Hyperlinks(1).Address

With CreateObject("scripting.FileSystemobject")
pathName = .GetParentFolderName(flAddress)
flName = .GetFileName(flAddress)
End With

With CreateObject("Shell.Application").Namespace(pathNa me)
flSize = .GetDetailsOf(.Items.Item(flName), PROP_FILE)
End With
GetFileSize = flSize
End Function

Thanks again for the fast reply.

Terry, East Grinstead, UK