Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 'If' with text values

Hello All,

I think my pascal background is hampering me here. All I need to do is
is this -

If the numercial value in A1 is 1 then make the text value in A2
'hello'
If the numercial value in A1 is 2 then make the text value in A2
'goodbye'

I have the structure but just can't get the syntax correct - can anyone
help please?

Thanks Liam.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 'If' with text values

=if(A1=1,"Hello",if(A1=2,"Goodbye",""))

--
Regards,
Tom Ogilvy


"Liam" wrote in message
ups.com...
Hello All,

I think my pascal background is hampering me here. All I need to do is
is this -

If the numercial value in A1 is 1 then make the text value in A2
'hello'
If the numercial value in A1 is 2 then make the text value in A2
'goodbye'

I have the structure but just can't get the syntax correct - can anyone
help please?

Thanks Liam.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 'If' with text values

Thanks Tom, Sorry I wan't clear enough!

There are a whole bunch of possible values and outcomes, way too many
for a nested IF statement approach.

I was looking for a VB solution something along the lines of Case or If
?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 'If' with text values

Try

=CHOOSE(H1,"A","B","C","D")

just extend the list as needed.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Liam" wrote in message
oups.com...
Thanks Tom, Sorry I wan't clear enough!

There are a whole bunch of possible values and outcomes, way too many
for a nested IF statement approach.

I was looking for a VB solution something along the lines of Case or If
?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 'If' with text values

Easier to create a table of numbers in the left column and results in the
right column, then use

=if(A1="","",vlookup(A1,Sheet2!A1:B1000,2,False))


Otherwise

Select Case Range("A1").Value
Case 1
res = "Hello"
Case 2
res = "Goodbye"
Case Else
res = "Not found"
End Select Case

msgbox Res



--
Regards,
Tom Ogilvy


"Liam" wrote in message
oups.com...
Thanks Tom, Sorry I wan't clear enough!

There are a whole bunch of possible values and outcomes, way too many
for a nested IF statement approach.

I was looking for a VB solution something along the lines of Case or If
?



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
Text to values Nadine Excel Worksheet Functions 4 April 22nd 10 02:11 AM
Sumif using Values, but returning text or values Jose Excel Discussion (Misc queries) 1 April 14th 10 09:01 PM
Plotting XY with X text values? Credit ratings and their ROE values Victor Blaer Charts and Charting in Excel 0 August 14th 09 03:08 PM
Finding values within text and substituting with alternate values. Bhupinder Rayat Excel Programming 3 January 24th 06 01:44 PM
Text values to numeric values jayveejay Excel Discussion (Misc queries) 1 August 10th 05 05:03 PM


All times are GMT +1. The time now is 10:47 AM.

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

About Us

"It's about Microsoft Excel"