Using Formulas in GoogleSheets for multiple cells - if-statement

If I have the title "Comm" in Cell A, then I want Cell C1 to be whatever Date Cell B has + 14 days.
If I have "Recruit" in Cell A, then I want Cell C1 to be whatever Date Cell B has + 30 days.
pasted in cell C1
=if(A1="Comm","B1+14,"")")
The result was False - what I need is a date +14 days from Cell B's entry.

I figured it out.
(Example)
If Cell B9 says H2O Recruit or PMS recruit then f9 will be 30 days from E9 otherwise make it 14 days from E9
(Answer)
=IF(OR(B9="H2O Recruit",B9="PMS Recruit"), E9+30,E9+14)

Related

Replace the word blank with 0 in card visualisation Power BI

I have my data say table "info" -
sl.no
zone
type
cost
01
east
typeA
223288
02
east
typeB
8897
03
east
typeC
2219
04
east
typeD
7628
05
north
typeB
10900
06
north
typeC
5998
In this data there are two zones east and north, and 4 types - A,B,C & D. Type A & D dosnt have north zone . In the visualisation(card), if I select north zone with type A and D their cost shows blank(according to the data which is correct). so what I want is where the zone is missing i want their cost to show 0 rather than showing written "blank". If its possible to do so please help me to get it.
Use this to measure and change it with your appropriate value in your table:
Measure = IF(ISBLANK(MAX([type])),"0",MAX([type]))

Power filter value based on the filter selection

I have different shipment data single sheet like below screen shot for reference
Trucksp Truckquty Filter Seasp Seaquty Filter STOsp STOquty Filter
45 66 TRUCK 55 67 SEA 34 45 STO
55 76 TRUCK 55 97 SEA 44 55 STO
45 66 TRUCK 25 27 SEA 22 88 STO
if i select truck filter i want show only trucksp and truckquty divide value . value should be show based on the filter selection . any idea .please help me
Measure= divide(max(tbl[trucksp]), max(tbl[truckquty))

Eliminate duplicate pairs of numbers and total their quantities in openoffice Calc

I have a Calc sheet listing a cut-list for plywood in two columns with a quantity in a third column. I would like to remove duplicate matching pairs of dimensions and total the quantity. Starting with:
A B C
25 35 2
25 40 1
25 45 3
25 45 2
35 45 1
35 50 3
40 25 1
40 25 1
Ending with:
A B C
25 35 2
25 40 1
25 45 5
35 45 1
35 50 3
40 25 2
I'm trying to automate this. Currently I have multiple lists which occupy the same page which need to be totaled independently of each other.
Put a unique different ListId, ListCode or ListNumber for each of the lists. Let all rows falling into the same list, have the same value for this field.
Concatenate A & B and form a new column, say, PairAB.
If the list is small and handlable, filter for PairAB and collect totals.
Otherwise, use Grouping and subtotals to get totals for each list and each pair, grouping on ListId and PairAB.
If the list is very large, you are better off taking it to CSV, and onward to a database, such things are simple child's play in SQL.

Check if a column exists and then sum in SAS

This is my input dataset:
Ref Col_A0 Col_01 Col_02 Col_aa Col_03 Col_04 Col_bb
NYC 10 0 44 55 66 34 44
CHG 90 55 4 33 22 34 23
TAR 10 8 0 25 65 88 22
I need to calculate the % of Col_A0 for a specific reference.
For example % col_A0 would be calculated as
10/(10+0+44+55+66+34+44)=.0395 i.e. 3.95%
So my output should be
Ref %Col_A0 %Rest
NYC 3.95% 96.05%
CHG 34.48% 65.52%
TAR 4.58% 95.42%
I can do this part but the issue is column variables.
Col_A0 and Ref are fixed columns so they will be there in the input every time. But the other columns won't be there. And there can be some additional columns too like Col_10, col_11 till col_30 and col_cc till col_zz.
For example the input data set in some scenarios can be just:
Ref Col_A0 Col_01 Col_02 Col_aa Col_03
NYC 10 0 44 55 66
CHG 90 55 4 33 22
TAR 10 8 0 25 65
So is there a way I can write a SAS code which checks to see if the column exists or not. Or if there is any other better way to do it.
This is my current SAS code written in Enterprise Guide.
PROC SQL;
CREATE TABLE output123 AS
select
ref,
(col_A0/(Sum(Col_A0,Col_01,Col_02,Col_aa,Col_03,Col_04,Col_bb)) FORMAT=PERCENT8.2 AS PERCNT_ColA0,
(1-(col_A0/(Sum(Col_A0,Col_01,Col_02,Col_aa,Col_03,Col_04,Col_bb))) FORMAT=PERCENT8.2 AS PERCNT_Rest
From Input123;
quit;
Scenarios where all the columns are not there I get an error. And if there are additional columns then I miss those. Please advice.
Thanks
I would not use SQL, but would use regular datastep.
data want;
set have;
a0_prop = col_a0/sum(of _numeric_);
run;
If you wanted to do this in SQL, the easiest way is to keep (or transform) the dataset in vertical format, ie, each variable a separate row per ID. Then you don't need to know how many variables there are to figure it out.
If you always want to sum all the numeric columns then just do :
col_A0 / sum(of _numeric_)

using numeric or alphabetic codes in statements; for use in "if" statements

I am wondering how to do something in COBOL. I am trying to write a program that uses if statements to output matching data records from a data file. But I have not done it like this yet see what I need to do is make codes for the different data types.
blue = 1
brown = 2.
So I tried it like this but it wouldn't work. This I have declared in the master-record:
01 COLOR-IN PIC (9)
05 BLUE VALUE 1.
05 BROWN VALUE 2.
Then I figured I could just write an if statement like
IF COLOR-IN = BLUE
PERFORM 200-OUTPUT.
So what I am asking is how do I make the colors equal a numeric or alphabetic code. What kind of statement should I write.
I figured it out. I used the 88 statements. Like this
88 MALE VALUE 'M'.
But I have another problem. The output does list the records that meet the 'if' statement criteria, however, I need to code in the program the actual hair and eye color so that when the program executes it prints the hair and eye color instead of 1 or 2. Can anyone give me an example or hint on how to do that?
+1 for learning about 88s. They are very useful.
A table (array) of labels that correspond to your values is what you're looking for. If you use alphabetic codes, as in your
88 MALE VALUE 'M' case, then your table has an entry for the value and for the label.
01 INPUT-VALUE PIC X(1).
88 MALE VALUE "M".
88 FEMALE VALUE "F".
01 LABELS-AND-VALUES-AREA.
05 LABELS-AND-VALUES.
07 ONE-LABEL-AND-VALUE OCCURS 2.
09 ONE-LABEL PIC X(6).
09 ONE-VALUE PIC X(1).
05 FILLER REDEFINES LABELS-AND-VALUES
VALUE "MALE MFEMALEF".
01 I PIC S9(4) COMP.
01 DISPLAY-LABEL PIC x(6).
MOVE "?" TO DISPLAY-LABEL
PERFORM VARYING I FROM 1 BY 1 UNTIL I > 2
IF INPUT-VALUE = ONE-VALUE(I)
MOVE ONE-LABEL(I) TO DISPLAY-LABEL
END-IF
END-PERFORM
If you use numerics for your input values, you can skip the lookup and go right to the label you want.
01 INPUT-VALUE PIC 9(1).
88 MALE VALUE "1".
88 FEMALE VALUE "2".
88 VALID-INPUT VALUE "1", "2".
01 LABELS-AND-VALUES-AREA.
05 LABELS-AND-VALUES.
07 ONE-LABEL-AND-VALUE OCCURS 2.
09 ONE-LABEL PIC X(6).
05 FILLER REDEFINES LABELS-AND-VALUES
VALUE "MALE FEMALE".
01 DISPLAY-LABEL PIC x(6).
IF VALID-INPUT
MOVE ONE-LABEL(INPUT-VALUE) TO DISPLAY-LABEL
ELSE
MOVE "?" TO DISPLAY-LABEL
END-IF
For this case, you might want to add some code for missing/unknown data.
Update
I added some code to handle missing/unknown data.