Solved

Formula Help

Posted on 2014-01-21
13
83 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +2
13 Comments
 
LVL 8

Expert Comment

by:Naresh Patel
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:Naresh Patel
ID: 39799039
Do u mean this?


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

Expert Comment

by:Naresh Patel
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:Naresh Patel
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:Naresh Patel
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 48

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

691 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