Using "SUMIF" array for particular values(date) only - excel

I have a log from restaurant of about last 4 months.
I have to calculate the total number of sold Products on Particular Date.
Here is the Sample format :
Date| Time | Product Code | Name | Price Sold Unit
7/2/2018 13:00 0101 XXX 100 4
7/2/2018 15:00 0101 XXX 100 6
7/3/2018 12:00 0101 ZZZ 100 4
7/3/2018 19:00 0101 ZZZ 100 4
Now I can use SUMIF and find out the total XXX and ZZZ sold. Which will equivalent to XXX = 10 and ZZZ = 8 .
But I want to calculate (SUM IF ) total on particular date which is of 7/2 and 7/3 .
I can use filter tab and select date and calculate. But the problem is log is of 30-31 Days . So it will take some time and I have about 3 months data to calculate.
Is it possible to calculate without using Filter tab for particular Date ?
Original FileReport

Assuming your data span from col A to col F. Try this.. and adjust accordingly..
=SUMIFS(F:F,D:D,"XXX",A:A,DATE(2018,7,2))
Hope that helps..

Related

SUMIFS across multiple sheets

So I'm working on a workbook right now that is across 3 sheets, 'Data', 'RAW', 'Lookup'. On the Data tab it looks like, Sheet 1
A B C D E
Segment Ranking Amount Revenue Spend
Carbon 15 2 5000 550
Oxygen 30 3 6895 450
Minerals 45 1 4400 350
The Code I use for each column are as follows (Some of the Columns are named columns)
B =IF(NOT(ISERROR(SEARCH("OK",$A2))),SUMIFS(RAW!B:B,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*"),SUMIFS(RAW!B:B,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*",Output,"<>*OK*"))
C =IF(NOT(ISERROR(SEARCH("OK",$A2))),SUMIFS(RAW!C:C,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*"),SUMIFS(RAW!C:C,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*",SegmentName,"<>*OK*"))
D =IF(NOT(ISERROR(SEARCH("OK",$A2))),SUMIFS(RAW!D:D,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*"),SUMIFS(RAW!D:D,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*",Output,"<>""OK"))
E =IF(NOT(ISERROR(SEARCH("OK",$A2))),SUMIFS(Spend,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*"),SUMIFS(Spend,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*",Output,"<>*OK*"))
The RAW Sheet looks like (Sheet 2)
A B C D E
Output Ranking Amount Revenue Spend
Random_1234_Random 15 2 5000 550
Random_5678_Random 30 3 6895 450
Random_9102_Random 45 1 4400 350
Random_555_Random 60 4 4000 300
The Lookup Sheet Looks like (Sheet 3)
A B
Segment ID
Carbon 1234
Oxygen 5678
Minerals 9102
Carbon 555
The problem that I have right now is, it will only grab the first Carbon with ID 1234, and not grab the second Carbon with ID 555 at all resulting in:
A B C D E
Segment Ranking Amount Revenue Spend
Carbon 15 2 5000 550
The end result that I would like is for it to grab ALL Carbon with any ID and add all of them together as below into a single line. (RAW sheet, Random_1234_Random + Random_555_Random)
A B C D E
Segment Ranking Amount Revenue Spend
Carbon 75 6 9000 850
Any help would be great and if I need to provide more detail please let me know!
Thank you in advance,
Maykid

Excel How to make a formula differenciate different vehicle plates

I have little knowlage of excel and I'm trying to configure an excel table so I can get the consumption of gas for each vehicle in a company, but all the data is introduced in only one table, how can I calculate the increase of km's of each vehicle to then be able to calculate the consumption?
The problem is that I don't know how to make the formula differenciate for each different plate.
The table is the following:
**A B C D E F G**
**1** Date Plate km Gas Signed Increased km's Consum
**2** 1/1/2018 0157-AAA 123456 50 YES
**3** 5/1/2018 0157-AAA 123789 20 NO
**4** 8/2/2018 0157-AAA 123987 30 NO
**5** 1/2/2018 0582-BBB 123456 40 YES
**6** 1/3/2018 0356-CCC 123456 30 NO
Another exemple:
Data Plate km Gas Increased km Consum %
3/5/2017 1111-AAA 150 20 150 13,33333333
7/5/2017 1111-AAA 400 30 250 12
7/5/2017 2222-BBB 50 10 50 20
7/5/2017 3333-CCC 20 5 20 25
10/5/2017 2222-BBB 200 30 150 20
Each plate is a different vehicle
Gas is the amount of oil that the vehicle refills in L
The table is updated daily or every 2-3 days as it's manually filled
The problem is calculating the increased km's as they may be other plates in between in the same date.
Consum % = Gas/Increased km *100
I thought about just ordering the columns by date and by plate and apply a general formula to everything
Thanks
I think I finally "solved my problem", the formula with the one I work is based on a filter for the plates in order to get them ordered. then the formula is:
Increased km =IF(B2=B1;C2-C1;C2)

Cognos Report Studio 10.2 Crosstab report with Percent difference for total difference

I am trying to create a Data Item that takes a column for difference between 2 fields that is calculated and has a total at the end of column 3. I want to then create another Data Item that takes each difference and get the percentage from the total of column 3 to get that percentage.
Row Column1 column2 column3 column4
XXX 100 90 10 (XXX column3(10) / total(column3(45)))
YYY 50 35 15 same as above but for YYY
ZZZ 60 40 20 same as above but for ZZZ
total 210 165 45 21.42%
I cannot get the column4 to calculate correctly. I have changed the aggregate function to "Calculated".
Any help is appreciated.
Thanks Dan
It looks simple. Try
column3 / total(column3 for report)

Allocate class based on school ranking

In Excel I am trying to allocate classes to pupils based on their ranking in school. The set of data I have looks like this:
S/N Name LevelPosition
1 Andrea 10
2 Bryan 25
3 Catty 5
4 Debbie 26
5 Ellie 30
6 Freddie 28
I would like to have a formula that could sort the pupils based on the LevelPosition and allocate the class in order of this sequence - A,B,C,C,B,A. Hence the result would be:
S/N Name LevelPosition AllocatedClass
3 Catty 5 A
1 Andrea 10 B
2 Bryan 25 C
4 Debbie 26 C
6 Freddie 28 B
5 Ellie 30 A
This was the sort of thing I had in mind.
Column D is just a ranking from bottom to top:-
=RANK(C2,C$2:C$7,1)
Colum D is adjusted for any ties:-
=D2+COUNTIF(D$1:D1,D2)
Column E is based on the #pnuts formula:-
=CHOOSE(MOD(E2-1,6)+1,"A","B","C","C","B","A")
I've put some ties in to show what would happen. The last two students' allocations are reversed because the second to last has the higher mark.

Oracle Date Time strig format

I have the following oracle table, where datetime is in a single column & has datatype as string
f_ID f_type f_date
1001 A 3/30/14 12:20:00 PM
1001 B 3/30/14 10:20:00 AM
1002 A 2/3/14 11:0:00 AM
1002 B 2/3/14 9:00:00 AM
1003 A 2/13/14 10:00:00 AM
1003 B 12/13/14 10:00:00 AM
1111 B 12/13/14 10:00:00 AM
I wish to calculate average time taken for all shipments which have count > 1. So time difference in shipment of 1001 is 2 hours, 1002 is 2 hours, 1003 is 10 Months (303 x 24=7272) hours. 1111 has count =1 so it can be excluded from average.
So the average result should be (2+2+7272)/3 = 2425.33 hours.
How do I query that?
This one should work:
WITH t AS
(SELECT f_ID, ABS(b.f_date-a.f_date)*24 AS duration
FROM my_table a
JOIN my_table b USING (f_ID)
WHERE a.f_type = 'A'
AND a.f_type = 'B')
SELECT AVG(duration)
FROM t;

Resources