[Solved] Nesting IF Function not Working

Discuss the spreadsheet application
Post Reply
Pulling37
Posts: 2
Joined: Wed May 16, 2018 6:48 pm

[Solved] Nesting IF Function not Working

Post by Pulling37 »

Why is my formula not working on the ELSE portion? Thanks for your help.
My Formula is here
My Formula is here
Last edited by Pulling37 on Wed May 16, 2018 7:34 pm, edited 1 time in total.
OpenOffice 4.1.5 on Windows10
FJCC
Moderator
Posts: 9280
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Nesting IF Function not Working

Post by FJCC »

FIND() does not return 0 when it fails to find the text, it returns a #VALUE error, which stops further evaluation of the formula. You can use ISERROR() to catch that. Here are two versions. The first uses NOT(ISERROR(FIND())) to produce the logic you meant with FIND () > 0

Code: Select all

=IF(NOT(ISERROR(FIND("Hastings";B2)));"Hastings";IF(NOT(ISERROR(FIND("Waurika";B2)));"Waurika";""))
The second one drops the NOT(), so the logic is inverted

Code: Select all

=IF(ISERROR(FIND("Hastings";A1));IF(ISERROR(FIND("Waurika";A1));"";"Waurika");"Hastings")
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Pulling37
Posts: 2
Joined: Wed May 16, 2018 6:48 pm

Re: Nesting IF Function not Working

Post by Pulling37 »

OH Thank you so much!! That first one worked for me....now to nest more for more towns.
OpenOffice 4.1.5 on Windows10
User avatar
RusselB
Moderator
Posts: 6646
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: [Solved] Nesting IF Function not Working

Post by RusselB »

Please note that there are limitations as to the number of parameters that you can have in a single IF statement. In this case, the single IF statement is the initial IF.... the subsequent IF's that are contained in the initial IF don't extend the number of parameters, but, realistically do reduce them.
If you are going to have a lot of these, then I suggest you consider making a small table and work with one or more of the lookup functions (eg: VLOOKUP, LOOKUP, MATCH and INDEX come to mind quickly)
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
Post Reply