Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with forumula

Status
Not open for further replies.

grecon

Technical User
Mar 8, 2007
78
US
Hi I have this formula:

if {ADDRESS.STATE}= "NY" then {ADDRESS.COUNTY}else "NONE"

now I want to add to it to say and if {ADDRESS.COUNTY} = suffolk then 8.5, if the {ADDRESS.COUNTY} is nassau then 8 but I am not sure how add this to my existing formula. Could somone tell me the correct formula?

Thanks
 
I am not certain if this is what you really want, but do think that this may point you in the right direction:

if ({ADDRESS.STATE}= "NY"
AND {ADDRESS.COUNTY}= "suffolk") THEN {ADDRESS.COUNTY} & 8.5
ELSE
(
IF {ADDRESS.STATE}= "NY"
AND {ADDRESS.COUNTY}= "nassau" THEN {ADDRESS.COUNTY} & 8
else "NONE"
)
 
I have another way of doing it:

If {ADDRESS.COUNTY}= ["BROOME","CATTARAUGUS","CAYUGA","CHEMUNG","CHENANGO","CLINTON","COLUMBIA","CORTLAND","DELAWARE","FRANKLIN","FULTON","GENESEE","GREENE","LIVINGSTON","MADISON","MONROE","MONTGOMERY","NIAGARA","ONONDAGA","ORLEANS","OSWEGO","OTSEGO","RENSSELAER","SCHENECTADY","SCHOHARIE","SCHUYLER","SENECA","STEUBEN","SULLIVAN","TIOGA","TOMPKINS","ULSTER","WAYNE","WYOMING","YATES"] then "8" or
IF {ADDRESS.COUNTY}= ["ALLEGANY"] THEN "8.50"

but I get an error once I put the OR in so I must have the formula wrong, I need to say if XXX then xxx or if xxx then xxx or if xxx then xxx. What am I doing wrong??
 
Hi,
try:
Code:
If {ADDRESS.COUNTY}= ["BROOME","CATTARAUGUS","CAYUGA","CHEMUNG","CHENANGO","CLINTON","COLUMBIA","CORTLAND","DELAWARE","FRANKLIN","FULTON","GENESEE","GREENE","LIVINGSTON","MADISON","MONROE","MONTGOMERY","NIAGARA","ONONDAGA","ORLEANS","OSWEGO","OTSEGO","RENSSELAER","SCHENECTADY","SCHOHARIE","SCHUYLER","SENECA","STEUBEN","SULLIVAN","TIOGA","TOMPKINS","ULSTER","WAYNE","WYOMING","YATES"] 
then "8" 
ELSE 
IF {ADDRESS.COUNTY}= ["ALLEGANY"] 
THEN "8.50"

Since it cannot be 2 counties at once, the If..Then..Else construct is appropriate.




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Hi,
A further thought:
If those are ALL the counties referenced/needed in your report, then a much simpler test will do:
Code:
IF {ADDRESS.COUNTY}= ["ALLEGANY"] 
THEN "8.50"
ELSE
"8"


[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top