Oct 24, 2020
Divide by zero error when trying to get an average from cells containing IFS formula
In cells Q3:Q64 I have this formula:
=IFS(P11=0,"",P11<=25,"4",P11<=100,"3",P11<=250,"2",P11>250,"1")
The formula in Q3:Q64 is working fine and it does what I want it to. However in Q2 I am getting a divide by zero error. This error occurs even if all cells in the range Q3:Q64 have a number or is blank. Is it simply not possible to get the average or sum from a range that has an IFS formula in it? Or should I be using different syntax in Q2? Any help is appreciated. - Rod
Details
Informational notification.
This question is locked and replying has been disabled.
Community content may not be verified or up-to-date. Learn more.
Oct 26, 2020
Hi, Ron,
Your formula is outputting numbers as text and not numeric. You cannot perform math operations on numbers as text.
When you enclose a number in double-quotes you are telling it to be as text.
I duplicated the Status tab and deleted all your formulas in column B and replace it with a single formula in cell B3 only as follows
=ArrayFormula(IFS(A3:A=0,,A3:A<=25,4,A3:A<=100,3,A3:A<=250,2,A3:A>250,1))
I also duplcated the Input tab an deleted all the formulas in column J and replaced it with a single formula in cell F3 only as follows
=ArrayFormula(IF(LEN(I3:I),iferror(I3:I/F3:F),))
I hope this helps,
Ben Liebrand
Original Poster Rod Warren 5014 marked this as an answer
Helpful?Upvote Downvote
All Replies (23)
Oct 25, 2020
Hi, Ron,
Keep in mind we cannot see what you see so it would be difficult to offer a solution? There are many unknown variables so we would need something to work with.
For me, or other forum contributors to help (in case I'm not around), I suggest that you share an editable COPY of your sheet. Use your sample sheet to demonstrate what you'd like the sheet to do! Here are some tips to help you get a great answer quickly... Product Experts TIPS FOR SHARING
***** Tip: Read the Tips post above, then check your sharing settings before posting - you want "Anyone with the link can Edit"
Ben Liebrand
Oct 27, 2020
Hi, Ron,
Based on what you have shown, see my example tab in your spreadsheet.
I am using the following formula is row 3
={Ford!C1;Chev!C1}
={Ford!B1;Chev!B1}
={Ford!D1;Chev!D1}
I hope this helps,
Ben Liebrand
When you've received a response that answers your question, please observe these forum courtesies;
• Leave your demo sheet shared as part of this solution's archive,
• Click Recommend on the post that best addressed your question, and
• Post again soon!
Oct 27, 2020
=INDEX(cardata!$A$1:$Z, MATCH("ford",cardata!$A$1:$A,0), 4)
That formula looks to the 'cardata' sheet and searches 'ford' and then returns the value from the 4th column. I think. lol. I did not create the formula I just saw it in a different file and that's how it seems to work.
So my question summarized is: Is there a method to modify the formula you put in 'Ben_Example_Output summary' so that it will look in Column A and use whatever name is in Column A to pull data from any sheets that are the identical name as the word in Column A. In your example sheet, if I were to put in cell A5 the word 'Dodge' and also create a sheet called 'Dodge' then the formula would look for the sheet called 'Dodge' and pull in the data as is now in Columns B, D, and F (warranty length, price, colour options). The end result would be that I could create new sheets (like 'Ford' and 'Chev') and then all I would need to do is type the name of that sheet in Column A of 'Ben_Example_Output summary' and it would pull in the required data without needing to add the name of the sheet to the formula.
Please let me know if you need anything clarified in what I'm asking.
Thanks again Ben,
Rod
Oct 27, 2020
Hi, Ron,
I am not sure I understand what you are asking? There is a lot going on in what you are describing which seems confusing.
Anyway, I took a wild shot at this and created Another_Example tab in your spreadsheet and entered the following formula into cell B3
=ArrayFormula(if(len(A3:A),iferror(vlookup(A3:A,{Ford!A3:D;Chev!A3:D},{4,2,3},)),))
As I said, it is a wild guess and I could be barking up the wrong tree.
I hope this helps,
Ben Liebrand
Oct 27, 2020
Hi, Ron
And yes, if you ad more tabs to your spreadsheet then you have to manually enter them into the formulas. Google Sheet will not do this automatically. I mean, how would Google Sheets know it ahs to add the new tabs. It has to be a manual decision from your side.
I hope that makes sense.
Ben Liebrand
Oct 27, 2020
I noticed in the instructions that the site wants me to keep the shared version of this sheet available, which I can do if you would like. I'd assume that moving it to a different folder will not 'unshare' at all? I just have it in the root directory so I'd like to just tidy that up.
Thanks Ben
Oct 27, 2020
Hi, Ron,
Before designing a project you need to understand what you can and cannot do. I don't understand your project so it is difficult to say do this or do that.
So, yes, you can enter Ford into a cell and use it in a formula. The problem is, it is very limited and inefficient. You would id the indirect() function. The problem is, the indirect() function cannot be used in an ArrrayFormula.
The way you design a project would be very different from the way I design a project. I like to simplify things and get the spreadsheet to do the work for me and not the other way around. That way I also reduce the number of unnecessarily complicated formulas as well as drawn-out development time.
When your spreadsheet becomes too complicated it is not efficeint to update amd maintain from formulas point of view.
So by using the indicrect() function you would end up with many formulas that needs to me updated in many placed in the spreadsheet.
Of cource, if you are doing something very simple and basic then you can opt for doing thing that way. But as I said, I don't understand your project and you have not shown an example of what you are attemptiong to do. When you descibe it to me I have to try and visualise it and that makes it difficult to grasp it and offer a solution.
The formula I use is as follows
=iferror({indirect(A3&"!A3:D")})
I hope this helps,
Ben Lierband
Last edited Oct 27, 2020
Oct 27, 2020
Hi, Ron,
I would recommend you familiarise yourself with the various functions individually using simple and basic data sets so you can understand how they work and behave. That will give you better direction on how to approach your project.
Google Sheets is very powerful and you can do great things with it. But you want to take the best approach that will be more efficient and simpler to maintain.
I hope this makes sense.
Feel free to ask questions, but try and offer an example of what you are trying to achieve.
Ben Liebrand
Oct 28, 2020
=INDEX(cardata!$A$1:$Z, MATCH("Ford",cardata!$A$1:$A,0), 4)
This formula tells G sheets to search in a certain range for a word "Ford" and then pull data from that sheet, from specific cells.
That type of formula would not work because I'd still have to type 'Ford' in it, and would have to do the same for every formula in the row, so I figure there must be a method to tell the formula to reference the text in Column A instead of having to type the Brand name (sheet name) in the formula.
So ultimately I would have a spreadsheet that will automatically pull in a variety of data from a new sheet simply by putting the name of the sheet in Column A and having a formula get the sheet name from Column A.
I hope the example I set up and this explanation clarifies what I'm trying to achieve in this project.
Thanks again Ben,
Rod
Oct 29, 2020
Hi, Ron,
Typical formula examples
=if(len(A2),indirect("Auto "&A2&"!B1"),)
=if(len(A2), IFS(C2<21,4,C2<26,3,C2<36,2,TRUE,1),)
=IF(LEN(A2), IFS(F2<100,1,F2<200,2,F2<300,3,TRUE,4),)
In each case the formulas are dragged down to the last row in the tab.
I hope this helps,
Ben Liebrand
Oct 30, 2020
That formula is ingenious! It did exactly what I was hoping for. Big thanks to you for all your help on this journey. I will keep the spreadsheet shared as per instructions. If I have other spreadsheet questions in the future is there a way I can contact you instead of doing a general post and hoping for the best?
Oct 30, 2020
Hi, Ron,
You are welcome and thank you for your feedback.
I'm glad I was able to help.
Ben Liebrand
When you've received a response that answers your question, please observe these forum courtesies;
• Leave your demo sheet shared as part of this solution's archive,
• Click Recommend on the post that best addressed your question, and
• Post again soon!
Oct 30, 2020
Hi, Ron,
When you've received a response that answers your question, please observe these forum courtesies;
• Leave your demo sheet shared as part of this solution's archive,
• Click Recommend on the post that best addressed your question, and
• Post again soon!