Solved

Formula Help

Posted on 2014-01-21
13
78 Views
Last Modified: 2014-10-26
Hello, trying to fix this formula, get a too many arguments error.

=IF(COUNTIF(AE6,AE39:AE41,"*Thunderstorm*")>0,9,IF(COUNTIF(AE6,AE39:AE41,"*Freezing*")>0,8,IF(COUNTIF(AE6,AE39:AE41,"*Snow*")>0,7,IF(COUNTIF(AE6,AE39:AE41,"*Blowing*")>0,6,IF(COUNTIF(AE6,AE39:AE41,"*Rain*")>0,5,IF(COUNTIF(AE6,AE39:AE41,"*Fog*")>0,4,IF(COUNTIF(AE6,AE39:AE41,"*Winds*")>0,3,1)))))))
0
Comment
Question by:sandramac
  • 5
  • 3
  • 2
  • +2
13 Comments
 
LVL 8

Expert Comment

by:itjockey
ID: 39799024
Hi sandramac,

will you provide sample workbook pls?



thanks
0
 

Author Comment

by:sandramac
ID: 39799028
Basically I need to see if the criteria such as, Thunderstorm, appears in cell AE6 or AE39 to AE 41. if so then cell equal 9, if not then continue to evaluate for the next criteria which is Freezing.
0
 
LVL 22

Expert Comment

by:Flyster
ID: 39799033
The correct formula for countif is CountIf(Range, Criteria). If you remove the AE6, it will work:

=IF(COUNTIF(AE39:AE41,"*Thunderstorm*")>0,9,IF(COUNTIF(AE39:AE41,"*Freezing*")>0,8,IF(COUNTIF(AE39:AE41,"*Snow*")>0,7,IF(COUNTIF(AE39:AE41,"*Blowing*")>0,6,IF(COUNTIF(AE39:AE41,"*Rain*")>0,5,IF(COUNTIF(AE39:AE41,"*Fog*")>0,4,IF(COUNTIF(AE39:AE41,"*Winds*")>0,3,1)))))))

Flyster
0
 
LVL 8

Expert Comment

by:itjockey
ID: 39799039
Do u mean this?


=IF(COUNTIF(AE39:AE41,"ThunderStrom")>0,9)
0
 
LVL 8

Expert Comment

by:itjockey
ID: 39799042
=IF(COUNTIF(AE39:AE41,"Thunderstorm")>0,9,IF(COUNTIF(AE39:AE41,"Freezing")>0,8,IF(COUNTIF(AE39:AE41,"Snow")>0,7,IF(COUNTIF(AE39:AE41,"Blowing")>0,6,IF(COUNTIF(AE39:AE41,"Rain")>0,5,IF(COUNTIF(AE39:AE41,"Fog")>0,4,IF(COUNTIF(AE39:AE41,"Winds")>0,3,1)))))))
0
 
LVL 8

Expert Comment

by:itjockey
ID: 39799044
oh sorry you got answer refresh IE and seen....




Thanks
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 81

Expert Comment

by:byundt
ID: 39799086
If you have Excel 2007 or later, you can use the IFERROR function to return the value for no matches.

You can use LOOKUP with the reciprocal of the COUNTIF using an array of matching values to find the last matching word in the array. So by reversing the order of the tests (i.e. Thunderstorm is last), you can handle all the cases with a compact formula--and no nested IF functions.

You have to test ranges AE6 and AE39:AE41 separately, but the formula doing so is half the length of one using nested IF functions.
=MAX(IFERROR(LOOKUP(2,1/COUNTIF(AE6,"*" & {"Winds","Fog","Rain","Blowing","Snow","Freezing","Thunderstorm"} & "*"),{3,4,5,6,7,8,9}),1),IFERROR(LOOKUP(2,1/COUNTIF(AE39:AE41,"*" & {"Winds","Fog","Rain","Blowing","Snow","Freezing","Thunderstorm"} & "*"),{3,4,5,6,7,8,9}),1))

Open in new window

The above formula does not need to be array-entered.
0
 

Author Comment

by:sandramac
ID: 39799100
I also need to evaluation cell AE6 to, in addition to AE39:AE41
0
 
LVL 81

Expert Comment

by:byundt
ID: 39799103
I did evaluate both cells AE6 and AE39:AE41 in my suggested formula. The first IFERROR & LOOKUP handles AE6 while the second handles AE39:AE41.

I repeat the formula below with line feeds so you can see the pieces more clearly.

=MAX(
IFERROR(LOOKUP(2,1/COUNTIF(AE6,"*" & {"Winds","Fog","Rain","Blowing","Snow","Freezing","Thunderstorm"} & "*"),{3,4,5,6,7,8,9}),1),
IFERROR(LOOKUP(2,1/COUNTIF(AE39:AE41,"*" & {"Winds","Fog","Rain","Blowing","Snow","Freezing","Thunderstorm"} & "*"),{3,4,5,6,7,8,9}),1)
)
0
 
LVL 81

Accepted Solution

by:
byundt earned 500 total points
ID: 39800126
Here is an explanation for the formula:
COUNTIF(AE6,"*" & {"Winds","Fog","Rain","Blowing","Snow","Freezing","Thunderstorm"}  & "*")
Returns array of counts for each possible weather condition in AE6

LOOKUP(2,1/COUNTIF(AE6,"*" ....),{3,4,5,6,7,8,9})
Returns 3, 4, 5 etc for last non-zero count in array returned by COUNTIF. Ignores errors caused by zero counts. Returns error value if there was no match for a weather condition.

IFERROR(LOOKUP(....), 1)
Returns the value returned by LOOKUP if it wasn't an error. Returns 1 if LOOKUP returned an error (no matching weather condition).

=MAX(IFERROR(LOOKUP2,1/COUNTIF(AE6,....),....),1),    IFERROR(LOOKUP2,1/COUNTIF(AE39:AE41,....),....),1))
Returns larger value from weather conditions in AE6 and AE39:AE41
WeatherReporterQ28344728.xlsx
0
 
LVL 8

Expert Comment

by:itjockey
ID: 39800225
Sir byundt,
Best part of your answer is - in each and every answer  your explanation. how it comes.  Really really appreciated.


Thanks
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40404645
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now