Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / August 2006

Tip: Looking for answers? Try searching our database.

Bread down numbers by categories based on value with uneven steps

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nekodvoru - 01 Aug 2006 17:32 GMT
Hello

How can I break up a column of numbers by categories with uneven steps
without going to long iif statement

Thank you for your help
jahoobob - 01 Aug 2006 18:51 GMT
?

>Hello
>
>How can I break up a column of numbers by categories with uneven steps
>without going to long iif statement
>
>Thank you for your help
Klatuu - 01 Aug 2006 18:52 GMT
Not enough info.  Where do you want to do this, report, query, ?

> Hello
>
> How can I break up a column of numbers by categories with uneven steps
> without going to long iif statement
>
> Thank you for your help
Nekodvoru - 01 Aug 2006 18:59 GMT
I want to do it in a query.
I have a list categories based on value in the first column
for example
<25,000
25000< but 50000
but steps are not even
sorry for confusion

> Not enough info.  Where do you want to do this, report, query, ?
>
[quoted text clipped - 4 lines]
> >
> > Thank you for your help
John Vinson - 01 Aug 2006 19:51 GMT
>Hello
>
>How can I break up a column of numbers by categories with uneven steps
>without going to long iif statement
>
>Thank you for your help

A "Range" table can be useful here: three fields, Low, High, Category.
E.g.

0   63   F
64  72   D
73  80   C
80  88   G
89 100   A

You can then create a "Non Equi Join" query:

SELECT mytable.this, mytable.that, mytable.score, Ranges.Category
FROM mytable
INNER JOIN Ranges
ON Ranges.Low <= mytable.score
AND Ranges.High >= mytable.score;

                 John W. Vinson[MVP]
Nekodvoru - 01 Aug 2006 21:12 GMT
Thanks a lot
It worked

> >Hello
> >
[quoted text clipped - 21 lines]
>
>                   John W. Vinson[MVP]    
John Nurick - 01 Aug 2006 21:09 GMT
One way is by using the Switch() function in a calculated field in a
query, e.g. this converts values in the Score field into categories:

Category: Switch([Score]<40,"F", [Score]<50, "D", [Score]<65, "C",
[Score]<75, "B", [Score]<85, "A", [Score]>=85, "A+")

Switch takes pairs of arguments. Starting with the first pair, it
evaluates the first argument: if it evaluates to True or -1, it
evaluates and returns the value of the second argument; if the first
argument does not evaluate to True, Switch starts over with the next
pair of arguments.

(For more help on Switch(), open the VBA editor and type
    Switch Function
into the help box.)

>Hello
>
>How can I break up a column of numbers by categories with uneven steps
>without going to long iif statement
>
>Thank you for your help

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.