View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.newusers
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default JOINING OF TEXT & DATE

SJ

If not familiar with VBA and macros, see David McRitchie's site for more on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + R to open Project Explorer.

Find your workbook/project and select it.

Right-click and InsertModule. Paste the UDF code in there. Save the
workbook and hit ALT + Q to return to Excel window.

Enter the formula as shown in prior posts.

This UDF adds the ordinal to any number.

The number in this case is provided by the DAY(A1) part.


Gord

On Fri, 6 Oct 2006 07:51:15 -0400, "SJ" wrote:

Gord,

Your formula is what I was ideally looking for, however, as I am not sure
what UDF is and how to use the code that you had given below.

SJ

"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
With a UDF and this formula..........

="Receipts from: 1st to " & ordinalnumber(DAY(A1)) & " of "
&TEXT(A1,"mmmm")

Function OrdinalNumber(ByVal Num As Long) As String
Dim n As Long
Const cSfx = "stndrdthththththth"
n = Num Mod 100
If ((Abs(n) = 10) And (Abs(n) <= 19)) _
Or ((Abs(n) Mod 10) = 0) Then
OrdinalNumber = Format(Num) & "th"
Else
OrdinalNumber = Format(Num) & Mid(cSfx, _
((Abs(n) Mod 10) * 2) - 1, 2)
End If
End Function


Gord Dibben MS Excel MVP


On Thu, 5 Oct 2006 15:17:13 -0400, "SJ" wrote:

Hello!

Text = "Receipts from:"
Date = 10/5/06. (This date will in a different cell and will change every
month)

The decription I desire will be: "Receipts from: "1st to 5th October" or
any
variation thereof as long as it shows the period

Thanks
SJ




Gord Dibben MS Excel MVP