Display Grand Total only when a column have value greater than 0 - google-sheets

I have DEALER MAP Quantity columns in Google Sheets
On the MAP column I am having my Grand total which is the SUM of my MAP column.
The Quantity column is having 0s which means there is no Product selected.
I want to show the Grand Total as 0 under MAP but Not 0 when any number more than 0 is added into Quantity.
The 10% is the row for finding TAX.The fomulas are here
for TAX
=(D3*E3+D5*E5+D6*E6+D7*E7+D8*E8+D9*E9+D10*E10+D11*E11+D12*E12+D13*E13+D14*E14+D15*E15)*D20
For The Grand Total
=SUM(D3:D15,E20)

you can use IF like:
=IF(SUM(D3:D15, E20)=0,, SUM(D3:D15, E20))
or if you are not fan of repeating formula twice you can do:
=IFERROR(1/(1/SUM(D3:D15, E20))
update:
=SUM(FILTER(IFERROR(D3:D20*E3:E20), E3:E20<>0),E29)

Related

How to not take Null values while doing table calculation but keep them for the aggregated total

Background:
I have a cohort analysis table that shows month of year on the Y axis (Rows) and Difference from next month as my X axis (columns). With Customers as my measure, you see values from 0 to 12 on the column side, showing all the conversions from that particular month and people who did not make a conversion are shown as Null.
Problem:
As I have a table with column showing Null, 0,1,2... 8 showing values, and the total of this shows me my cohort size. So as a customer, Null is important as it shows the size of the total group. But I want to have a percentage of each group and show the cumulative growth of the group without taking the null group.
Summary
I want to show a cumulative percentage growth but not take my first column (that is the null values) but keep it to have the totals show correct value.
The following image can help you understand
For January 2022,
You have the total value of each column
You see the individual percentage of that column/ total
You see the cumulative percentage growth total
Result to see: if we can do cumulative percentage total without taking the Nulls.
Follow up Clarification from Image:
The expected answer should look like this
For 0 --> 3.9%
For 1 --> 7.8% (3.9%+3.9%)
For 2 --> 9.5% (3.9%+3.9%+ 1.7%)
As you can see, the percentage value takes the total cohort size and shows the 3.9%,which is the correct value and doing cumulative by excluding the Null value % that is 87.1% (therefore hiding the Null value column)

How to apply array formula taking data from another table?

We have two tables in Google Sheets.
First:
Date
Amount
Currency
Worth
01.01.2021
100
USD
373
02.01.2021
100
EUR
451
03.01.2021
100
PLN
100
04.01.2021
100
USD
373
05.01.2021
100
USD
372
Second:
Date
PLN
EUR
USD
01.01.2021
1
4,50
3,73
02.01.2021
1
4,51
3,75
03.01.2021
1
4,50
3,74
04.01.2021
1
4,48
3,73
05.01.2021
1
4,49
3,72
I tried find array formula for first table, column Worth. Formula should take proper value from second table (based on two columns from table one - Date and Currency) and multiply that values by worth in column Amount. I really want to use array formula. Is it possible?
Use VLOOKUP to find the correct date row and MATCH to find which column the value is in:
=ARRAYFORMULA(IFERROR(VLOOKUP(A2:A,I2:L,MATCH(C2:C,I1:L1,0))*B2:B))
Option 01: Getting the result with one cell one formula.
Paste this in B3 "Amount" column in the first table, take a look at this Sheet.
=ArrayFormula(IF(ArrayFormula(IF(A3:A="",,VLOOKUP(A3:A,G3:J,ArrayFormula(IF(D3:D="",,MATCH(D3:D,$H$2:$J$2,0)+1)),0)))="",,ArrayFormula(IF(A3:A="",,VLOOKUP(A3:A,G3:J,ArrayFormula(IF(D3:D="",,MATCH(D3:D,$H$2:$J$2,0)+1)),0)))*E3:E))
Explanation ...
1 - MATCH(D3:D,$H$2:$J$2,0) To get the index you want to VLOOKUP the "Currency" column from the second table with, we need that in the next step.
2 - VLOOKUP the "date" found in First table A3:A from Range in the second table G3:J, with Index set to MATCH(D3:D,$H$2:$J$2,0), and [is_sorted] set to 0
3 - till now we have the value of the exchange rate if we can call it that for each Currency chosen in the first Table, we need to multiply it by Worth to get Amount
ArrayFormula(IF(A3:A="",,VLOOKUP(A3:A,G3:J,ArrayFormula(IF(D3:D="",,MATCH(D3:D,$H$2:$J$2,0)+1)),0)))*E3:E is structured like this Exchange rate * Amount note that E3:E is the Amount, and this IF(A3:A="",, to calculate only when A3:A range is not blank.
4 - ArrayFormula and a IF is needed to be wrapped around like this ArrayFormula(IF(Range=Empty,Do nothing,formula)
Range:
ArrayFormula(IF(A3:A="",,VLOOKUP(A3:A,G3:J,ArrayFormula(IF(D3:D="",,MATCH(D3:D,$H$2:$J$2,0)+1)),0)))
Empty
""
Do nothing :
,,
Formula:
ArrayFormula(IF(A3:A="",,VLOOKUP(A3:A,G3:J,ArrayFormula(IF(D3:D="",,MATCH(D3:D,$H$2:$J$2,0)+1)),0)))*E3:E
Option 02: Getting the result with intermediate steps.
Same as option 01 but in seprate columns take a look at this Sheet.

Ho to do the automation to calculate the quantity left, profit and loss when there is new data input in google sheet?

Hi everyone,
I have 4 ranges of data:
A1:C5 (Product In Storage), there will be new data input if there are other new products coming in.
E1:G8 (Sales), this is the record for all the products that are being sold, there will be new data input also in the future.
I1:K5 (Summary of Sales), this will record the Quantity Left in the storage and also the total Profit or Loss after doing some calculation based on A1:C5 and E1:G8. The number of rows for Summary of Sales should be equal to the number of rows of Product In Storage (So I'm using query function highlighted in yellow).
M1:O5 (Desired Output), this is the final result that I want to achieve for this task.
My goal is to calculate the Quantity Left & Profit or Loss in Summary of Sales automatically once there are new data input in Product In Storage & Sales.
I'm not sure how to do it because the number of rows in Sales is a not a constant. In this example, the are 2 rows data for Product ID: 1001.01 & 3 rows data for Product ID: 1002.01. In the future, after the remaining quantity (34) for Product ID: 1001.01 had been sold, it need to be included in the Summary of Sales as well.
I attached the google sheet link below in case you need it: https://docs.google.com/spreadsheets/d/17coke3-oyDRLHgz79PDl3KX68kFOEte-aynVe-xEITU/edit?usp=sharing
Is there anyway to do this without using the google apps script? Any help will be greatly appreciated!
For your example,
J4 -> =SUMIF(A:A,I4,C:C) - SUMIF(E:E,I4,G:G) means;
(First sumif, get inventory) Whenever you see I4 in A:A column, get the C value on that row and sum all of them.
(And minus)
(Second sumif, minus sales) Whenever you see I4 in E:E column, get the G value on that row and sum all of them.
(Result) = Get storage quantity and substitute the sales quantity.
K4 -> =ArrayFormula(SUMPRODUCT(IF(E:E=I4,F:F*G:G)) - SUMPRODUCT(IF(A:A=I4,B:B*C:C)))
means,
(get income) if you see I4 on E:E column, then get the sum of (F*G)
(minus)
(get expense) if you see I4 on A:A column, then get the sum of (B*C)
But if i were you, to keep things more simple, i would put =Quantity*Price right of your tables and you can solve problems with only =SUMIF formulas. FYI, this will update everytime you change a value from table so when things get nastier, it will become slower indeed. When that time comes, a VBA macro button or Formulas->Calculation method will save your day.

Google sheets Forumla - How to get unique sum for each row using data from 2 columns?

There are 2,827 rows in Column A
Each have a different USD Dollar Value.
Column B Has the same value of 4.99 for the 2,827 rows.
Whats the formula to get the unique sum for the 2,827 rows in column C?
Column D has the same rate of 20.00% for the 2,827 rows
What is the formula to get the grand total?
As I understand you want to add all the total values together.
If you want to have a Grand Total below, you should write just:
=sum(e2:e5) in your e6 cell.
But if you want to add more rows and keep your grand total in the same place, it's useful to have it on top. Like on the picuture:
=sum(e2:e) means that it adds all the cell values found between row 2 and end of this column.
It's also strange that you add 20% in column D. This way you add 0.2 to each value. If this is your intention and insurance costs 20 cents, it's ok. But if you want to add 20% to subtotal value, you should put =c2*1.2 in insurance column.

Tricky getting average for price when summing extended and qty

The data we display is summarized by order type. Data looks: where ABCDE is the sum of one or more rows with same item #.
Item Order Type QTY PRICE EXT. PRICE
ABCDE INT 10 $100
I am not displaying price because this row is a summary of several in time frame selected. Price on these items changes in time or for customer.
So What I can do is give an average price.
I have 2 formulas but the result is not correct. all result is same number 91,979.00
formula 'new avg' sum({DATA_WHSV3.ITEM_PRC$}) / count({DATA_WHSV3.ITEM_PRC$})
then If {#new avg} > 0 then
sum({DATA_WHSV3.ITEM_PRC$})/{#new avg}
You can use a Running Total Field to do the average for you. So say your report is grouped by Item# you would create a new Running Total Field.
Running Total Name: RTotal0 (can be anything, this is just the default)
Field to Summarize: {DATA_WHSV3.ITEM_PRC$}
Type of Summary: average
Evaluate: For each record
Reset: On change of group: Group #1: DATA_WHSV3.ITEM_NUMBER
Then you can drop the {#RTotal0} into the group footer along with the other details for that item number and it should be the correct average.

Resources