Solved

Formula Help

Posted on 2014-01-21
13
79 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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
 
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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

770 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