Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Multiple IFs


I have roughly 100 values I need to format cells with using the if
function. Is this possible? I need the cell to display each 'if' value
when the relevant figure is inserted.

Thanks


Phil


--
phil2006
------------------------------------------------------------------------
phil2006's Profile: http://www.excelforum.com/member.php...o&userid=35092
View this thread: http://www.excelforum.com/showthread...hreadid=558775

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Multiple IFs

Hi Phil,

I have roughly 100 values I need to format cells with using the if
function. Is this possible? I need the cell to display each 'if' value
when the relevant figure is inserted.


Try something like:

'=============
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim rcell As Range
Const sAdd As String = "A1:A10"

Set rng = Intersect(Range(sAdd), Target)

For Each rcell In rng.Cells
With rcell
Select Case .Value
Case 1: .Value = "Anne"
Case 2: .Value = "Ben"
Case 3: .Value = "Carol"

'................
'................
Case 100: .Value = "Xavier"
End Select
End With
Next rcell
End Sub

'<<=============

This is worksheet event code and should be pasted into the worksheets's code
module (not a standard module and not the workbook's ThisWorkbook module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Multiple IFs


Thanks. How do you set the values though? For example, if I want it to
show Anne every time the value in the cell is 1.2 where do I insert
this?

Thanks again,

Phil


--
phil2006
------------------------------------------------------------------------
phil2006's Profile: http://www.excelforum.com/member.php...o&userid=35092
View this thread: http://www.excelforum.com/showthread...hreadid=558775

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Multiple IFs

Phil,
If you that many items, why not use VLOOKUP. So, if A1="Anne", in A2 you
have:
=VLOOKUP(A1,rngData,2,False)
where rngData is a named range of:
Anne 1.2
Bill 1.5
John 0.8

NickHK

"phil2006" wrote in
message ...

Thanks. How do you set the values though? For example, if I want it to
show Anne every time the value in the cell is 1.2 where do I insert
this?

Thanks again,

Phil


--
phil2006
------------------------------------------------------------------------
phil2006's Profile:

http://www.excelforum.com/member.php...o&userid=35092
View this thread: http://www.excelforum.com/showthread...hreadid=558775



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Multiple IFs


Thanks. I have been trying the vlookup with no success! What I need i
an if function that says if the value is 1.49 and <1.51 it gives 1/2
if the value = 5 it returns 5/1 etc...

Thank

--
phil200
-----------------------------------------------------------------------
phil2006's Profile: http://www.excelforum.com/member.php...fo&userid=3509
View this thread: http://www.excelforum.com/showthread.php?threadid=55877



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Multiple IFs

Phil,
I don't see how this fits in with the previous requirement of Anne=1.2.
Confused.

NickHK

"phil2006" wrote in
message ...

Thanks. I have been trying the vlookup with no success! What I need is
an if function that says if the value is 1.49 and <1.51 it gives 1/2,
if the value = 5 it returns 5/1 etc...

Thanks


--
phil2006
------------------------------------------------------------------------
phil2006's Profile:

http://www.excelforum.com/member.php...o&userid=35092
View this thread: http://www.excelforum.com/showthread...hreadid=558775



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
Delete Blank Rows Code - Multiple Worksheets - Multiple Documents BenS Excel Discussion (Misc queries) 3 June 29th 07 12:20 AM
Crteating Multiple GIFS from Multiple Ranges -- need someone to test my code to see why it fails Father Guido[_5_] Excel Programming 4 November 22nd 05 05:28 AM
Creating Multiple GIFs from Multiple Range selections -- I need a volunteer to test my code to see why it fails Father Guido[_5_] Excel Programming 0 November 19th 05 08:52 AM
Crteating Multiple GIFS from Multiple Ranges -- need someone to test my code to see why it fails Father Guido[_5_] Excel Programming 0 November 19th 05 08:00 AM
view multiple files in multiple windows on multiple screens. tcom Excel Discussion (Misc queries) 7 September 15th 05 09:35 PM


All times are GMT +1. The time now is 11:30 PM.

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"