Avoiding repeat of IF statement without helper cell

Tom83

New Member
Joined
Apr 23, 2021
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Hi guys,

I have a graph line that shows zero's for future quarters, I want to remove them for the green line. Formatting the cell in any way doesn't fix the issue, it's sees the cell as a value zero.

1619165688337.png


The only way is to make the future values #N/A, that fixes the issue. But the formula is very long and I would like to avoid repeating the IF statement, is there any way I can let the formula evaluate itself without repeating the IF statement and without using a helper cell?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
It might be easier to use a dynamic named range for the line series' data range that only goes up to a specified period (or just finds the last non-zero value).
 
Upvote 0
It might be easier to use a dynamic named range for the line series' data range that only goes up to a specified period (or just finds the last non-zero value).
Thanks for this, sounds like a good option. As I'm not that experienced, how would I do this?
 
Upvote 0
You'd use a combination of INDEX and MATCH generally. Is there a cell with the current quarter value in it that can be used for the match? We also need to know which ranges the values and category labels are in.
 
Upvote 0
You'd use a combination of INDEX and MATCH generally. Is there a cell with the current quarter value in it that can be used for the match? We also need to know which ranges the values and category labels are in.
Great, yes there is:

1619180190652.png


I extract the values in cells F7:I10 referring to a pivot table
 
Upvote 0
You'd use a combination of INDEX and MATCH generally. Is there a cell with the current quarter value in it that can be used for the match? We also need to know which ranges the values and category labels are in.
Hi RoryA, any idea how to fix this?
 
Upvote 0
Your category range would be:

Excel Formula:
=Sheet1!$B$6:INDEX(Sheet1!$6:$6,MATCH("Q1-21",Sheet1!$6:$6,0))

for example, and you'd repeat a similar construction for the data series. Ideally you'd have Q1-21 in a cell somewhere so that you can reference that cell and then update all the formulas just by updating that cell.
 
Upvote 0
Your category range would be:

Excel Formula:
=Sheet1!$B$6:INDEX(Sheet1!$6:$6,MATCH("Q1-21",Sheet1!$6:$6,0))

for example, and you'd repeat a similar construction for the data series. Ideally you'd have Q1-21 in a cell somewhere so that you can reference that cell and then update all the formulas just by updating that cell.
Great, almost there! I just get an error when putting this in the category axis:

=Sheet1!$B$6:INDEX(Sheet1!$6:$6,MATCH("Q1-21",Sheet1!$6:$6,0))

1619612722193.png
 
Upvote 0
Sorry - I missed out an important step! You should use those formulas in defined named ranges (using the Name Manager), then use the name in the axis label dialog. For example define a name called AxisLabels that uses the formula above (assuming sheet name is correct), then in that dialog you'd use: =Sheet1!AxisLabels
 
Upvote 0
Sorry - I missed out an important step! You should use those formulas in defined named ranges (using the Name Manager), then use the name in the axis label dialog. For example define a name called AxisLabels that uses the formula above (assuming sheet name is correct), then in that dialog you'd use: =Sheet1!AxisLabels
Thanks, almost there! What to put in the series values dialog? As can be seen in the graph the values are still showing zero's, the axis is correct.

1619641958017.png
 
Upvote 0

Forum statistics

Threads
1,215,096
Messages
6,123,074
Members
449,093
Latest member
ripvw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top