If statement to Return the previous non zero value in a column

PatrickHenry

New Member
Joined
Dec 12, 2017
Messages
4
Hi All,

I have this Google Sheets workbook that is meant to compare sales for the past 4 months. The reports for each month are pulled in automatically from sales force and the 0 values are from the weekends mostly when no sales come in. To compare 4 months on 1 line graph, the lines need to be overlapping and not side by side, I need to show the MAX value at the end of Day 1 for each month on one table.

Example. January Month Report. Pulls in the raw data from column 1 and 2 automatically. The last 3 columns are calculated formulas on the Google Sheet.

<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
Jan DateJan AccountsCheck for DupesJan CountJan % to Goal
1/1/20185555555555511.000.39%
1/1/20185555555555501.000.39%
1/1/20184545454545412.000.78%

<colgroup><col style="width: 100px"><col width="127"><col width="100"><col width="100"><col width="100"></colgroup><tbody>
</tbody>

I then used Formula A (below) to create the table below, giving me the max value at the end of day 1 for each month. The issue is that the 0.00% values from the weekends with no sales are causing the line graph to look very odd. I cannot edit the Salesforce reports to bring in calculated fields, only raw data.

I need a formula that IF 0.00% is the result of the Formula A, AND there is a NON ZERO value before then that value is returned. Ex If Day 1 max value for Jan was 0 then 0.00% would be returned. If its Day 14 and the max value of that day in Jan is 0.00% then 23.25% would be returned as it is the most recent non zero value in the Jan column of the below table.

Formula A
=ArrayFormula(MAX(IF(Day(All!P32:P151) = A32, All!T32:T151)))

<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
DayJanFebMarchApril
10.78%5.49%3.47%0.71%
21.56%8.06%4.51%2.49%
33.11%8.42%0.00%3.56%
45.06%0.00%5.21%4.98%
58.17%12.45%6.60%7.12%
68.56%13.92%8.68%9.61%
70.00%17.58%12.50%0.00%
810.12%22.34%16.67%9.96%
912.45%26.37%19.10%13.88%
1015.56%26.74%0.00%20.28%
1120.23%27.11%0.00%23.49%
1223.35%30.77%21.53%24.91%
130.00%32.60%23.61%0.00%
140.00%34.43%24.31%0.00%
1528.02%39.19%25.69%0.00%
1631.52%42.49%28.47%0.00%
1736.19%0.00%0.00%0.00%
1840.08%0.00%28.82%0.00%
1942.80%43.59%30.90%0.00%
200.00%46.15%34.72%0.00%
210.00%48.72%40.63%0.00%
2246.69%51.28%45.83%0.00%
2352.53%55.68%50.69%0.00%
2457.59%56.04%0.00%0.00%
2560.70%0.00%0.00%0.00%
2666.54%61.17%56.60%0.00%
270.00%67.40%60.07%0.00%
280.00%83.88%65.97%0.00%
2969.65%0.00%73.96%0.00%
3078.60%0.00%86.46%0.00%
3190.27%0.00%89.24%0.00%

<colgroup><col style="width: 51px"><col width="100"><col width="87"><col width="78"><col width="55"></colgroup><tbody>
</tbody>

*I apologize if the explanation is lacking, let me know any additional details you need
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
=ArrayFormula(IFERROR(1/(1/(MAX(IF(DAY(Jan_Demos!$A$2:$A$40000) = A3, Jan_Demos!$Q$2:$Q$40000)))),B2))

** make sure to have a row of 0% above the first cell in case the first of the month is on a weekend
 
Upvote 0

Forum statistics

Threads
1,213,554
Messages
6,114,280
Members
448,562
Latest member
Flashbond

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