Solved

Formula Help

Posted on 2014-01-21
13
80 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

839 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