LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Can I simplify this function

Function WhichBox(piIndex As Integer) As Integer

If piIndex < 5 Then
WhichBox = 1
ElseIf piIndex < 9 Then
WhichBox = 2
ElseIf piIndex < 13 Then
WhichBox = 3
Else
WhichBox = 4
End If

End Function


I am going round in loops with / and mod - I am sure I can do it with
one line of code, but how do I do it please, i.e.

PiIndex Returns
1 to 4 1
5 to 8 2
9 to 12 3
13 to 16 4
--
Mike
 
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
Help me simplify this function.... killertofu Excel Worksheet Functions 6 February 15th 06 01:46 PM
simplify a vlookup function Caveman Excel Worksheet Functions 1 September 26th 05 03:39 PM
simplify function Luke Excel Worksheet Functions 13 May 3rd 05 02:07 AM
Simplify Vlookup function in Excel Budman Excel Worksheet Functions 7 March 27th 05 04:17 PM
Simplify CrossJoin function Damien Excel Programming 1 January 25th 05 02:48 PM


All times are GMT +1. The time now is 12:18 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"