How to deal with numbers not on a specified value? (between two?)

• (2 Pages)
• 1
• 2

22 Replies - 1126 Views - Last Post: 10 July 2014 - 10:31 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=350109&amp;s=4cd7c0810d25e476c9fcc3ea6cd0d4dc&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

#16 ZakaryHansen

Reputation: 0
• Posts: 158
• Joined: 28-February 14

Re: How to deal with numbers not on a specified value? (between two?)

Posted 10 July 2014 - 09:32 AM

```Private Sub SizeV()
If (Value_A >= 0) And (Value_A <= ((0 + 1008981770) / 2)) Then
ComboBox.SelectedItem = "0"
ElseIf (Value_A > ((0 + 1008981770) / 2)) And (Value_A <= ((1008981770 + 1017370378) / 2)) Then
ComboBox.SelectedItem = "1"
ElseIf (Value_A > ((1008981770 + 1017370378) / 2)) And (Value_A <= ((1017370378 + 1022739087) / 2)) Then
ComboBox.SelectedItem = "2"
ElseIf (Value_A > ((1017370378 + 1022739087) / 2)) And (Value_A <= ((1022739087 + 1025758986) / 2)) Then
ComboBox.SelectedItem = "3"
ElseIf (Value_A > ((1022739087 + 1025758986) / 2)) And (Value_A <= ((1025758986 + 1028443341) / 2)) Then
ComboBox.SelectedItem = "4"
ElseIf (Value_A > ((1025758986 + 1028443341) / 2)) And (Value_A <= ((1028443341 + 1029161615) / 2)) Then
ComboBox.SelectedItem = "5"
ElseIf (Value_A > ((1028443341 + 1029161615) / 2)) And (Value_A <= ((1029161615 + 1032805417) / 2)) Then
ComboBox.SelectedItem = "6"
ElseIf (Value_A > ((1029161615 + 1032805417) / 2)) And (Value_A <= ((1032805417 + 1034147594) / 2)) Then
ComboBox.SelectedItem = "7"
ElseIf (Value_A > ((1032805417 + 1034147594) / 2)) And (Value_A <= ((1034147594 + 1035489772) / 2)) Then
ComboBox.SelectedItem = "8"
ElseIf (Value_A > ((1034147594 + 1035489772) / 2)) And (Value_A <= ((1035489772 + 1036831949) / 2)) Then
ComboBox.SelectedItem = "9"
ElseIf (Value_A > ((1035489772 + 1036831949) / 2)) And (Value_A <= ((1036831949 + 1038174126) / 2)) Then
ComboBox.SelectedItem = "10"
ElseIf (Value_A > ((1036831949 + 1038174126) / 2)) And (Value_A <= ((1038174126 + 1039516303) / 2)) Then
ComboBox.SelectedItem = "11"
ElseIf (Value_A > ((1038174126 + 1039516303) / 2)) And (Value_A <= ((1039516303 + 1040522936) / 2)) Then
ComboBox.SelectedItem = "12"
ElseIf (Value_A > ((1039516303 + 1040522936) / 2)) And (Value_A <= ((1040522936 + 1041194025) / 2)) Then
ComboBox.SelectedItem = "13"
ElseIf (Value_A > ((1040522936 + 1041194025) / 2)) And (Value_A <= ((1041194025 + 1041865114) / 2)) Then
ComboBox.SelectedItem = "14"
ElseIf (Value_A > ((1041194025 + 1041865114) / 2)) And (Value_A <= ((1041865114 + 1042536202) / 2)) Then
ComboBox.SelectedItem = "15"
ElseIf (Value_A > ((1041865114 + 1042536202) / 2)) And (Value_A <= ((1042536202 + 1043207291) / 2)) Then
ComboBox.SelectedItem = "16"
ElseIf (Value_A > ((1042536202 + 1043207291) / 2)) And (Value_A <= ((1043207291 + 1043878380) / 2)) Then
ComboBox.SelectedItem = "17"
ElseIf (Value_A > ((1043207291 + 1043878380) / 2)) And (Value_A <= ((1043878380 + 1044549468) / 2)) Then
ComboBox.SelectedItem = "18"
ElseIf (Value_A > ((1043878380 + 1044549468) / 2)) And (Value_A <= ((1044549468 + 1045220557) / 2)) Then
ComboBox.SelectedItem = "19"
ElseIf (Value_A > ((1044549468 + 1045220557) / 2)) And (Value_A <= ((1045220557 + 1045891645) / 2)) Then
ComboBox.SelectedItem = "20"
ElseIf (Value_A > ((1045220557 + 1045891645) / 2)) And (Value_A <= ((1045891645 + 1046562734) / 2)) Then
ComboBox.SelectedItem = "21"
ElseIf (Value_A > ((1045891645 + 1046562734) / 2)) And (Value_A <= ((1046562734 + 1046562734) / 2)) Then
ComboBox.SelectedItem = "22"
ElseIf (Value_A > ((1046562734 + 1046562734) / 2)) And (Value_A <= ((1047233823 + 1047904911) / 2)) Then
ComboBox.SelectedItem = "23"
ElseIf (Value_A > ((1047233823 + 1047904911) / 2)) And (Value_A <= ((1047904911 + 1048576000) / 2)) Then
ComboBox.SelectedItem = "24"
ElseIf (Value_A > ((1047904911 + 1048576000) / 2)) And (Value_A <= ((1048576000 + 1048911544) / 2)) Then
ComboBox.SelectedItem = "25"
ElseIf (Value_A > ((1048576000 + 1048911544) / 2)) And (Value_A <= ((1048911544 + 1049247089) / 2)) Then
ComboBox.SelectedItem = "26"
ElseIf (Value_A > ((1048911544 + 1049247089) / 2)) And (Value_A <= ((1049247089 + 1049582633) / 2)) Then
ComboBox.SelectedItem = "27"
ElseIf (Value_A > ((1049247089 + 1049582633) / 2)) And (Value_A <= ((1049582633 + 1049918177) / 2)) Then
ComboBox.SelectedItem = "28"
ElseIf (Value_A > ((1049582633 + 1049918177) / 2)) And (Value_A <= ((1049918177 + 1050253722) / 2)) Then
ComboBox.SelectedItem = "29"
ElseIf (Value_A > ((1049918177 + 1050253722) / 2)) And (Value_A <= ((1050253722 + 1050589266) / 2)) Then
ComboBox.SelectedItem = "30"
ElseIf (Value_A > ((1050253722 + 1050589266) / 2)) And (Value_A <= ((1050589266 + 1050924810) / 2)) Then
ComboBox.SelectedItem = "31"
ElseIf (Value_A > ((1050589266 + 1050924810) / 2)) And (Value_A <= ((1050924810 + 1051260355) / 2)) Then
ComboBox.SelectedItem = "32"
ElseIf (Value_A > ((1050924810 + 1051260355) / 2)) And (Value_A <= ((1051260355 + 1051595899) / 2)) Then
ComboBox.SelectedItem = "33"
ElseIf (Value_A > ((1051260355 + 1051595899) / 2)) And (Value_A <= ((1051595899 + 1051931443) / 2)) Then
ComboBox.SelectedItem = "34"
ElseIf (Value_A > ((1051595899 + 1051931443) / 2)) And (Value_A <= ((1051931443 + 1052266988) / 2)) Then
ComboBox.SelectedItem = "35"
ElseIf (Value_A > ((1051931443 + 1052266988) / 2)) And (Value_A <= ((1052266988 + 1052602532) / 2)) Then
ComboBox.SelectedItem = "36"
ElseIf (Value_A > ((1052266988 + 1052602532) / 2)) And (Value_A <= ((1052602532 + 1052938076) / 2)) Then
ComboBox.SelectedItem = "37"
ElseIf (Value_A > ((1052602532 + 1052938076) / 2)) And (Value_A <= ((1052938076 + 1053273620) / 2)) Then
ComboBox.SelectedItem = "38"
ElseIf (Value_A > ((1052938076 + 1053273620) / 2)) And (Value_A <= ((1053273620 + 1053609165) / 2)) Then
ComboBox.SelectedItem = "39"
ElseIf (Value_A > ((1053273620 + 1053609165) / 2)) And (Value_A <= ((1053609165 + 1053944709) / 2)) Then
ComboBox.SelectedItem = "40"
ElseIf (Value_A > ((1053609165 + 1053944709) / 2)) And (Value_A <= ((1053944709 + 1054280253) / 2)) Then
ComboBox.SelectedItem = "41"
ElseIf (Value_A > ((1053944709 + 1054280253) / 2)) And (Value_A <= ((1054280253 + 1054615798) / 2)) Then
ComboBox.SelectedItem = "42"
ElseIf (Value_A > ((1054280253 + 1054615798) / 2)) And (Value_A <= ((1054615798 + 1054951342) / 2)) Then
ComboBox.SelectedItem = "43"
ElseIf (Value_A > ((1054615798 + 1054951342) / 2)) And (Value_A <= ((1054951342 + 1055286886) / 2)) Then
ComboBox.SelectedItem = "44"
ElseIf (Value_A > ((1054951342 + 1055286886) / 2)) And (Value_A <= ((1055286886 + 1055622431) / 2)) Then
ComboBox.SelectedItem = "45"
ElseIf (Value_A > ((1055286886 + 1055622431) / 2)) And (Value_A <= ((1055622431 + 1055957975) / 2)) Then
ComboBox.SelectedItem = "46"
ElseIf (Value_A > ((1055622431 + 1055957975) / 2)) And (Value_A <= ((1055957975 + 1056293519) / 2)) Then
ComboBox.SelectedItem = "47"
ElseIf (Value_A > ((1055957975 + 1056293519) / 2)) And (Value_A <= ((1056293519 + 1056629064) / 2)) Then
ComboBox.SelectedItem = "48"
ElseIf (Value_A > ((1056293519 + 1056629064) / 2)) And (Value_A <= ((1056629064 + 1056964608) / 2)) Then
ComboBox.SelectedItem = "49"
ElseIf (Value_A > ((1056629064 + 1056964608) / 2)) And (Value_A <= ((1056964608 + 1057132380) / 2)) Then
ComboBox.SelectedItem = "50"
ElseIf (Value_A > ((1056964608 + 1057132380) / 2)) And (Value_A <= ((1057132380 + 1057300152) / 2)) Then
ComboBox.SelectedItem = "51"
ElseIf (Value_A > ((1057132380 + 1057300152) / 2)) And (Value_A <= ((1057300152 + 1057467924) / 2)) Then
ComboBox.SelectedItem = "52"
ElseIf (Value_A > ((1057300152 + 1057467924) / 2)) And (Value_A <= ((1057467924 + 1057635697) / 2)) Then
ComboBox.SelectedItem = "53"
ElseIf (Value_A > ((1057467924 + 1057635697) / 2)) And (Value_A <= ((1057635697 + 1057803469) / 2)) Then
ComboBox.SelectedItem = "54"
ElseIf (Value_A > ((1057635697 + 1057803469) / 2)) And (Value_A <= ((1057803469 + 1057971241) / 2)) Then
ComboBox.SelectedItem = "55"
ElseIf (Value_A > ((1057803469 + 1057971241) / 2)) And (Value_A <= ((1057971241 + 1058139013) / 2)) Then
ComboBox.SelectedItem = "56"
ElseIf (Value_A > ((1057971241 + 1058139013) / 2)) And (Value_A <= ((1058139013 + 1058306785) / 2)) Then
ComboBox.SelectedItem = "57"
ElseIf (Value_A > ((1058139013 + 1058306785) / 2)) And (Value_A <= ((1058306785 + 1058474557) / 2)) Then
ComboBox.SelectedItem = "58"
ElseIf (Value_A > ((1058306785 + 1058474557) / 2)) And (Value_A <= ((1058474557 + 1058642330) / 2)) Then
ComboBox.SelectedItem = "59"
ElseIf (Value_A > ((1058474557 + 1058642330) / 2)) And (Value_A <= ((1058642330 + 1058810102) / 2)) Then
ComboBox.SelectedItem = "60"
ElseIf (Value_A > ((1058642330 + 1058810102) / 2)) And (Value_A <= ((1058810102 + 1058977874) / 2)) Then
ComboBox.SelectedItem = "61"
ElseIf (Value_A > ((1058810102 + 1058977874) / 2)) And (Value_A <= ((1058977874 + 1059145646) / 2)) Then
ComboBox.SelectedItem = "62"
ElseIf (Value_A > ((1058977874 + 1059145646) / 2)) And (Value_A <= ((1059145646 + 1059313418) / 2)) Then
ComboBox.SelectedItem = "63"
ElseIf (Value_A > ((1059145646 + 1059313418) / 2)) And (Value_A <= ((1059313418 + 1059481190) / 2)) Then
ComboBox.SelectedItem = "64"
ElseIf (Value_A > ((1059313418 + 1059481190) / 2)) And (Value_A <= ((1059481190 + 1059648963) / 2)) Then
ComboBox.SelectedItem = "65"
ElseIf (Value_A > ((1059481190 + 1059648963) / 2)) And (Value_A <= ((1059648963 + 1059816735) / 2)) Then
ComboBox.SelectedItem = "66"
ElseIf (Value_A > ((1059648963 + 1059816735) / 2)) And (Value_A <= ((1059816735 + 1059984507) / 2)) Then
ComboBox.SelectedItem = "67"
ElseIf (Value_A > ((1059816735 + 1059984507) / 2)) And (Value_A <= ((1059984507 + 1060152279) / 2)) Then
ComboBox.SelectedItem = "68"
ElseIf (Value_A > ((1059984507 + 1060152279) / 2)) And (Value_A <= ((1060152279 + 1060320051) / 2)) Then
ComboBox.SelectedItem = "69"
ElseIf (Value_A > ((1060152279 + 1060320051) / 2)) And (Value_A <= ((1060320051 + 1060487823) / 2)) Then
ComboBox.SelectedItem = "70"
ElseIf (Value_A > ((1060320051 + 1060487823) / 2)) And (Value_A <= ((1060487823 + 1060655596) / 2)) Then
ComboBox.SelectedItem = "71"
ElseIf (Value_A > ((1060487823 + 1060655596) / 2)) And (Value_A <= ((1060655596 + 1060823368) / 2)) Then
ComboBox.SelectedItem = "72"
ElseIf (Value_A > ((1060655596 + 1060823368) / 2)) And (Value_A <= ((1060823368 + 1060991140) / 2)) Then
ComboBox.SelectedItem = "73"
ElseIf (Value_A > ((1060823368 + 1060991140) / 2)) And (Value_A <= ((1060991140 + 1061158912) / 2)) Then
ComboBox.SelectedItem = "74"
ElseIf (Value_A > ((1060991140 + 1061158912) / 2)) And (Value_A <= ((1061158912 + 1061326684) / 2)) Then
ComboBox.SelectedItem = "75"
ElseIf (Value_A > ((1061158912 + 1061326684) / 2)) And (Value_A <= ((1061326684 + 1061494456) / 2)) Then
ComboBox.SelectedItem = "76"
ElseIf (Value_A > ((1061326684 + 1061494456) / 2)) And (Value_A <= ((1061494456 + 1061662228) / 2)) Then
ComboBox.SelectedItem = "77"
ElseIf (Value_A > ((1061494456 + 1061662228) / 2)) And (Value_A <= ((1061662228 + 1061830001) / 2)) Then
ComboBox.SelectedItem = "78"
ElseIf (Value_A > ((1061662228 + 1061830001) / 2)) And (Value_A <= ((1061830001 + 1061997773) / 2)) Then
ComboBox.SelectedItem = "79"
ElseIf (Value_A > ((1061830001 + 1061997773) / 2)) And (Value_A <= ((1061997773 + 1062165545) / 2)) Then
ComboBox.SelectedItem = "80"
ElseIf (Value_A > ((1061997773 + 1062165545) / 2)) And (Value_A <= ((1062165545 + 1062333317) / 2)) Then
ComboBox.SelectedItem = "81"
ElseIf (Value_A > ((1062165545 + 1062333317) / 2)) And (Value_A <= ((1062333317 + 1062501089) / 2)) Then
ComboBox.SelectedItem = "82"
ElseIf (Value_A > ((1062333317 + 1062501089) / 2)) And (Value_A <= ((1062501089 + 1062668861) / 2)) Then
ComboBox.SelectedItem = "83"
ElseIf (Value_A > ((1062501089 + 1062668861) / 2)) And (Value_A <= ((1062668861 + 1062836634) / 2)) Then
ComboBox.SelectedItem = "84"
ElseIf (Value_A > ((1062668861 + 1062836634) / 2)) And (Value_A <= ((1062836634 + 1063004406) / 2)) Then
ComboBox.SelectedItem = "85"
ElseIf (Value_A > ((1062836634 + 1063004406) / 2)) And (Value_A <= ((1063004406 + 1063172178) / 2)) Then
ComboBox.SelectedItem = "86"
ElseIf (Value_A > ((1063004406 + 1063172178) / 2)) And (Value_A <= ((1063172178 + 1063339950) / 2)) Then
ComboBox.SelectedItem = "87"
ElseIf (Value_A > ((1063172178 + 1063339950) / 2)) And (Value_A <= ((1063339950 + 1063507722) / 2)) Then
ComboBox.SelectedItem = "88"
ElseIf (Value_A > ((1063339950 + 1063507722) / 2)) And (Value_A <= ((1063507722 + 1063675494) / 2)) Then
ComboBox.SelectedItem = "89"
ElseIf (Value_A > ((1063507722 + 1063675494) / 2)) And (Value_A <= ((1063675494 + 1063843267) / 2)) Then
ComboBox.SelectedItem = "90"
ElseIf (Value_A > ((1063675494 + 1063843267) / 2)) And (Value_A <= ((1063843267 + 1064011039) / 2)) Then
ComboBox.SelectedItem = "91"
ElseIf (Value_A > ((1063843267 + 1064011039) / 2)) And (Value_A <= ((1064011039 + 1064178811) / 2)) Then
ComboBox.SelectedItem = "92"
ElseIf (Value_A > ((1064011039 + 1064178811) / 2)) And (Value_A <= ((1064178811 + 1064346583) / 2)) Then
ComboBox.SelectedItem = "93"
ElseIf (Value_A > ((1064178811 + 1064346583) / 2)) And (Value_A <= ((1064346583 + 1064513355) / 2)) Then
ComboBox.SelectedItem = "94"
ElseIf (Value_A > ((1064346583 + 1064513355) / 2)) And (Value_A <= ((1064513355 + 1064682127) / 2)) Then
ComboBox.SelectedItem = "95"
ElseIf (Value_A > ((1064513355 + 1064682127) / 2)) And (Value_A <= ((1064682127 + 1064849900) / 2)) Then
ComboBox.SelectedItem = "96"
ElseIf (Value_A > ((1064682127 + 1064849900) / 2)) And (Value_A <= ((1064849900 + 1065017672) / 2)) Then
ComboBox.SelectedItem = "97"
ElseIf (Value_A > ((1064849900 + 1065017672) / 2)) And (Value_A <= ((1065017672 + 1065185444) / 2)) Then
ComboBox.SelectedItem = "98"
ElseIf (Value_A > ((1065017672 + 1065185444) / 2)) And (Value_A <= ((1065185444 + 1065353216) / 2)) Then
ComboBox.SelectedItem = "99"
ElseIf (Value_A > ((1065185444 + 1065353216) / 2)) And (Value_A <= 1065353216) Then
ComboBox.SelectedItem = "100"
Else : ComboBox.SelectedItem = "0"
End If
End Sub
```
This is my ACTUAL code. Even though a number may lie between to points (example, I have one value that lies with the 60 range, it does not select the 60 item. and I KNOW it's in the 60 range because I changed the "PatternSize.SelectedItem" to a MsgBox popup.)

I have no idea why it's not selecting the combobox and I was trying to make it easier to understand where the values differ by changing them to values of 5.

Aaaaand I figured it out.

Thanks for the help and I do apologize for getting frustrated. I just didn't know how to further explain and whatnot. This site has been the only coding site that's been able to help me prior to this misunderstanding.

#17 modi123_1

• Suitor #2

Reputation: 11593
• Posts: 45,745
• Joined: 12-June 08

Re: How to deal with numbers not on a specified value? (between two?)

Posted 10 July 2014 - 09:34 AM

Quote

Aaaaand I figured it out.

Care to elaborate? Maybe seeing what you figured out may help folks get a better view on what was the problem.

#18 ZakaryHansen

Reputation: 0
• Posts: 158
• Joined: 28-February 14

Re: How to deal with numbers not on a specified value? (between two?)

Posted 10 July 2014 - 09:38 AM

The coding worked, I had just failed at filling in the combo box.. I was missing the 51-60 items.

That's my bad and.. Yeah. I suck.

#19 Oppemaj

Reputation: 23
• Posts: 94
• Joined: 15-November 13

Re: How to deal with numbers not on a specified value? (between two?)

Posted 10 July 2014 - 09:55 AM

I think this is how you could do it:

``` If number < 5 Then
ComboBox1.Text = ""
ElseIf number = 5 OrElse number < 10 Then
ComboBox1.Text = "Example1"
ElseIf number = 10 OrElse number < 15 Then
ComboBox1.Text = "Example2"
ElseIf number = 15 OrElse number < 20 Then
ComboBox1.Text = "Example3"
End If
```

Sorry I didn't see page2 where last post lay.

#20 DarenR

• D.I.C Lover

Reputation: 556
• Posts: 3,667
• Joined: 12-January 10

Re: How to deal with numbers not on a specified value? (between two?)

Posted 10 July 2014 - 10:03 AM

`just out of curiosity-- what is this for?

#21 Oppemaj

Reputation: 23
• Posts: 94
• Joined: 15-November 13

Re: How to deal with numbers not on a specified value? (between two?)

Posted 10 July 2014 - 10:10 AM

I was answering to the first post, but I didn't see the other answers.

#22 modi123_1

• Suitor #2

Reputation: 11593
• Posts: 45,745
• Joined: 12-June 08

Re: How to deal with numbers not on a specified value? (between two?)

Posted 10 July 2014 - 10:11 AM

@oppen I believe he was talking to the OP and not you.

#23 Oppemaj

Reputation: 23
• Posts: 94
• Joined: 15-November 13

Re: How to deal with numbers not on a specified value? (between two?)

Posted 10 July 2014 - 10:31 AM

Thank you and sorry again.