Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
slh
 
Posts: n/a
Default Convert specific text to a corresponding number

I have a field that can contain one of four different text values, BV, BR,
FM, FR. I need to convert these to a number, Ex: BV=5, BR=4, FM=6 and FR=1.
Can I do this with one formula?
--
slh
  #2   Report Post  
 
Posts: n/a
Default

Hi

To do them in situ, you would need a macro, or use Find/Replace 4 times.
To do them in an adjacent column, you could use something like:
=((A2="BV")*5)+((A2="BR")*4)+((A2="FM")*6)+((A2="F R")*1)
Hope this helps.

--
Andy.


"slh" wrote in message
...
I have a field that can contain one of four different text values, BV, BR,
FM, FR. I need to convert these to a number, Ex: BV=5, BR=4, FM=6 and
FR=1.
Can I do this with one formula?
--
slh



  #3   Report Post  
slh
 
Posts: n/a
Default

Thanks Andy,
The formula to list them in an adjacent column worked perfectly.
--
slh


"Andy B" wrote:

Hi

To do them in situ, you would need a macro, or use Find/Replace 4 times.
To do them in an adjacent column, you could use something like:
=((A2="BV")*5)+((A2="BR")*4)+((A2="FM")*6)+((A2="F R")*1)
Hope this helps.

--
Andy.


"slh" wrote in message
...
I have a field that can contain one of four different text values, BV, BR,
FM, FR. I need to convert these to a number, Ex: BV=5, BR=4, FM=6 and
FR=1.
Can I do this with one formula?
--
slh




  #4   Report Post  
 
Posts: n/a
Default

Pleased to help and thanks for the feedback!

--
Andy.


"slh" wrote in message
...
Thanks Andy,
The formula to list them in an adjacent column worked perfectly.
--
slh


"Andy B" wrote:

Hi

To do them in situ, you would need a macro, or use Find/Replace 4 times.
To do them in an adjacent column, you could use something like:
=((A2="BV")*5)+((A2="BR")*4)+((A2="FM")*6)+((A2="F R")*1)
Hope this helps.

--
Andy.


"slh" wrote in message
...
I have a field that can contain one of four different text values, BV,
BR,
FM, FR. I need to convert these to a number, Ex: BV=5, BR=4, FM=6 and
FR=1.
Can I do this with one formula?
--
slh






  #5   Report Post  
slh
 
Posts: n/a
Default

Andy,
A couple of questions if I may,
1. I have another similar situation that I tried to modify your formula to
accomplish with no luck. This time it is text converted to text. Ex "P001"
or "P002" = "SPER", "P004" or "P005" = "MPER" and "P102" = "MH".

Also can you tell me what the *means in the formula you gave me.
Thanks,
--
slh


"Andy B" wrote:

Pleased to help and thanks for the feedback!

--
Andy.


"slh" wrote in message
...
Thanks Andy,
The formula to list them in an adjacent column worked perfectly.
--
slh


"Andy B" wrote:

Hi

To do them in situ, you would need a macro, or use Find/Replace 4 times.
To do them in an adjacent column, you could use something like:
=((A2="BV")*5)+((A2="BR")*4)+((A2="FM")*6)+((A2="F R")*1)
Hope this helps.

--
Andy.


"slh" wrote in message
...
I have a field that can contain one of four different text values, BV,
BR,
FM, FR. I need to convert these to a number, Ex: BV=5, BR=4, FM=6 and
FR=1.
Can I do this with one formula?
--
slh








  #6   Report Post  
 
Posts: n/a
Default

Hi

The way the formula works is by treating each part of the formula as a sum.
The first bit looks whether A2="BV" and returns a TRUE or a FALSE - which is
then coerced into being a 1 or a 0 by multiplying (*) it by whichever value
you want the result to be. If BR was in A2, for example, the formula:
=((A2="BV")*5)+((A2="BR")*4)+((A2="FM")*6)+((A2="F R")*1)
would create a sum of:
=(0*5)+(1*4)+(0*6)+(0*1) which gives a result of 4.
With a text result, however, you'll need to use IF statements - unles there
are a lot of options.
=IF(OR(A2="P001",A2="P002"),"SPER",IF(OR(A2="P004" ,A2="P005"),"MPER",IF(A2="P102","MH","None
of these")))
Hope this helps.

--
Andy.


"slh" wrote in message
...
Andy,
A couple of questions if I may,
1. I have another similar situation that I tried to modify your formula
to
accomplish with no luck. This time it is text converted to text. Ex
"P001"
or "P002" = "SPER", "P004" or "P005" = "MPER" and "P102" = "MH".

Also can you tell me what the *means in the formula you gave me.
Thanks,
--
slh


"Andy B" wrote:

Pleased to help and thanks for the feedback!

--
Andy.


"slh" wrote in message
...
Thanks Andy,
The formula to list them in an adjacent column worked perfectly.
--
slh


"Andy B" wrote:

Hi

To do them in situ, you would need a macro, or use Find/Replace 4
times.
To do them in an adjacent column, you could use something like:
=((A2="BV")*5)+((A2="BR")*4)+((A2="FM")*6)+((A2="F R")*1)
Hope this helps.

--
Andy.


"slh" wrote in message
...
I have a field that can contain one of four different text values,
BV,
BR,
FM, FR. I need to convert these to a number, Ex: BV=5, BR=4, FM=6
and
FR=1.
Can I do this with one formula?
--
slh








  #7   Report Post  
slh
 
Posts: n/a
Default

Thankyou for taking the time to explain, that helps me a lot! I am a bit of
a novice with formulas so I really appreciate it.
--
slh


"Andy B" wrote:

Hi

The way the formula works is by treating each part of the formula as a sum.
The first bit looks whether A2="BV" and returns a TRUE or a FALSE - which is
then coerced into being a 1 or a 0 by multiplying (*) it by whichever value
you want the result to be. If BR was in A2, for example, the formula:
=((A2="BV")*5)+((A2="BR")*4)+((A2="FM")*6)+((A2="F R")*1)
would create a sum of:
=(0*5)+(1*4)+(0*6)+(0*1) which gives a result of 4.
With a text result, however, you'll need to use IF statements - unles there
are a lot of options.
=IF(OR(A2="P001",A2="P002"),"SPER",IF(OR(A2="P004" ,A2="P005"),"MPER",IF(A2="P102","MH","None
of these")))
Hope this helps.

--
Andy.


"slh" wrote in message
...
Andy,
A couple of questions if I may,
1. I have another similar situation that I tried to modify your formula
to
accomplish with no luck. This time it is text converted to text. Ex
"P001"
or "P002" = "SPER", "P004" or "P005" = "MPER" and "P102" = "MH".

Also can you tell me what the *means in the formula you gave me.
Thanks,
--
slh


"Andy B" wrote:

Pleased to help and thanks for the feedback!

--
Andy.


"slh" wrote in message
...
Thanks Andy,
The formula to list them in an adjacent column worked perfectly.
--
slh


"Andy B" wrote:

Hi

To do them in situ, you would need a macro, or use Find/Replace 4
times.
To do them in an adjacent column, you could use something like:
=((A2="BV")*5)+((A2="BR")*4)+((A2="FM")*6)+((A2="F R")*1)
Hope this helps.

--
Andy.


"slh" wrote in message
...
I have a field that can contain one of four different text values,
BV,
BR,
FM, FR. I need to convert these to a number, Ex: BV=5, BR=4, FM=6
and
FR=1.
Can I do this with one formula?
--
slh









  #8   Report Post  
 
Posts: n/a
Default

No problem!

--
Andy.


"slh" wrote in message
...
Thankyou for taking the time to explain, that helps me a lot! I am a bit
of
a novice with formulas so I really appreciate it.
--
slh


"Andy B" wrote:

Hi

The way the formula works is by treating each part of the formula as a
sum.
The first bit looks whether A2="BV" and returns a TRUE or a FALSE - which
is
then coerced into being a 1 or a 0 by multiplying (*) it by whichever
value
you want the result to be. If BR was in A2, for example, the formula:
=((A2="BV")*5)+((A2="BR")*4)+((A2="FM")*6)+((A2="F R")*1)
would create a sum of:
=(0*5)+(1*4)+(0*6)+(0*1) which gives a result of 4.
With a text result, however, you'll need to use IF statements - unles
there
are a lot of options.
=IF(OR(A2="P001",A2="P002"),"SPER",IF(OR(A2="P004" ,A2="P005"),"MPER",IF(A2="P102","MH","None
of these")))
Hope this helps.

--
Andy.


"slh" wrote in message
...
Andy,
A couple of questions if I may,
1. I have another similar situation that I tried to modify your
formula
to
accomplish with no luck. This time it is text converted to text. Ex
"P001"
or "P002" = "SPER", "P004" or "P005" = "MPER" and "P102" = "MH".

Also can you tell me what the *means in the formula you gave me.
Thanks,
--
slh


"Andy B" wrote:

Pleased to help and thanks for the feedback!

--
Andy.


"slh" wrote in message
...
Thanks Andy,
The formula to list them in an adjacent column worked perfectly.
--
slh


"Andy B" wrote:

Hi

To do them in situ, you would need a macro, or use Find/Replace 4
times.
To do them in an adjacent column, you could use something like:
=((A2="BV")*5)+((A2="BR")*4)+((A2="FM")*6)+((A2="F R")*1)
Hope this helps.

--
Andy.


"slh" wrote in message
...
I have a field that can contain one of four different text values,
BV,
BR,
FM, FR. I need to convert these to a number, Ex: BV=5, BR=4,
FM=6
and
FR=1.
Can I do this with one formula?
--
slh











Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting a 'number' from text Anthony Slater Excel Discussion (Misc queries) 4 April 5th 05 01:47 PM
not able to convert text, or graphic number to regular number in e knutsenk Excel Worksheet Functions 1 April 2nd 05 08:41 AM
convert number to text and format it. Goda Excel Worksheet Functions 2 February 7th 05 08:07 PM
convert number to text and format it. Goda Excel Worksheet Functions 2 February 7th 05 04:37 PM
How do i convert a number of seconds to a date/time? Margo Excel Worksheet Functions 2 January 5th 05 12:09 AM


All times are GMT +1. The time now is 07:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"