Author |
Message |
SusanW
Newbie
Joined: 27 May 2009
Location: United States
Online Status: Offline
Posts: 4
|
Topic: adding a string of numbers Posted: 27 May 2009 at 12:28pm |
I have 2 fields I want to compare and need to add all the numbers in the field. Field 1 is a character field and I want to add all 9 characters together to get a total. although it is a character field, there are numbers in it.
Also, the second field is the same, character field with dashes "-" separating the numbers. (it is actually a SSN field).
What formula could I use to do this?
Thanks
|
Susan
|
IP Logged |
|
rahulwalawalkar
Senior Member
Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
|
Posted: 28 May 2009 at 1:46am |
Hi,
please can you post some sample data....
cheers
Rahul
|
IP Logged |
|
SusanW
Newbie
Joined: 27 May 2009
Location: United States
Online Status: Offline
Posts: 4
|
Posted: 28 May 2009 at 5:39am |
field A is 123-45-6789 and field B is 123-45-7877
how do I total the numbers in each field ?
Thanks!
|
Susan
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
|
Posted: 28 May 2009 at 6:37am |
val(replace({fieldA}, "-", "")) + val(replace({fieldB}, "-", ""))
should work...
|
IP Logged |
|
JohnT
Groupie
Joined: 20 Jan 2008
Online Status: Offline
Posts: 92
|
Posted: 28 May 2009 at 9:22am |
For field A, are you asking how to total 1+2+3+4+5+6+7+8+9 ?
Edited by JohnT - 28 May 2009 at 9:22am
|
IP Logged |
|
SusanW
Newbie
Joined: 27 May 2009
Location: United States
Online Status: Offline
Posts: 4
|
Posted: 28 May 2009 at 9:42am |
yes, I needed to strip out the dashes, then add the numbers together.
|
Susan
|
IP Logged |
|
JohnT
Groupie
Joined: 20 Jan 2008
Online Status: Offline
Posts: 92
|
Posted: 28 May 2009 at 12:05pm |
Try this. I setup fielda to be 123-45-6789 and it seems to work.
|
IP Logged |
|
SusanW
Newbie
Joined: 27 May 2009
Location: United States
Online Status: Offline
Posts: 4
|
Posted: 28 May 2009 at 12:10pm |
Thanks! I'll give it a try!
|
Susan
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
|
Posted: 28 May 2009 at 2:28pm |
Ahh...sorry misunderstood what you wanted. I thought you wanted to add, say, 2 ssns together. Why? Idunno.
Yeah, JohnT solution would add all the numbers up.
|
IP Logged |
|
|