I need some guidance on creation of a calculated field column...
I have two columns that should dictate the value in this calculated field
TCV and F01
F01 = No the field is blank
F01 = Yes and TCV GT or = 25000000 the field = CEO/COO
F01 = Yes and TCV < 25000000 the field = BG Group
=IF(F01="Yes",[TCV]>25000000,"CEO/COO","BG Team")
=IF(F01="No","",IF(F01="Yes",IF(TCV>=25000000,"CEO/COO","Business Group")))
Related
Hi,
picture is sample data
Column A is BAG ID which contain duplicate
Column B is the item inside the Bag
Column C is status if item are received
at Column D want to show :
a) if Column C is "SIP" AND the bag id also show that any item inside same bag id is "sip" will show = "Bag & awb rcv"
b)if Column C is "not sip" AND the bag id also show that any item inside same bag id is "not sip" will show = "Bag not rcv"
c) if Column C is "NOT SIP" AND the bag id also show that any item inside same bag id is "sip" will show = "Bag rcv , awb SL"
THANKS!
Give a try on below formula-
=IF(C2="SIP","Bag & AWB rcv",IF(AND(C2="NOT SIP",COUNTA(UNIQUE(FILTER($C$2:$C$9,$A$2:$A$9=A2)))=1),"Bag not rcv","Bag rcv , awb SL"))
col 1 contains rows that have just numbers and just text. example:
row 1 = 70
row 2 = RS
row 3= abcddkss
row 5 = 5
row 6 = 88
and so on
What I want to do is add a column using logic like this: if Col1 not a number then Col1 else null.
what I have so far:
=let mylist=List.RemoveItems(List.Transform({1..126}, each Character.FromNumber(_)),{"0".."9"})
in
if List.Contains(mylist,Text.From([Column1])) then [Column1] else null
however, this will not work for rows that have more than one letter and will only work on ones that have one letter
You can use this:
if Value.Is(Value.FromText([dat]), type number) then null else [dat]
You could also check if the string is purely digit characters.
if [Column1] = Text.Select([Column1], {"0".."9"}) then null else [Column1]
I am not too experienced with programming, and I got stuck in a research project in the asset management field.
My Goal:
I have 2 dataframes,- one containing aside from others columns "European short date"," SP150030after", "SP1500365before" (Screenshot) and second containing column "Dates" and "S&P 1500_return"(Screenshot). For each row in the first dataframe, I want to calculate cumulative returns of S&P 1500 for 365 days before the date in column "European short date" and cumulative returns of S&P 1500 for 30 days after the date in column "European short date" and put these results in columns "SP150030after" and "SP1500365before".
These returns are to be calculated using a second Dataframe. "S&P 1500_return" column in the second data frame for each date represents "daily return of S&P 1500 market index + 1". So, for example to get cumulative returns over 1 year before 31.12.2020 in first dataframe, I would have to calculate the product of values in column "S&P 1500_return" from the second dataframe for each day present (trading day) in the dataframe 2 during the period 31.12.2019 - 30.12.2020.
What I have tried so far:
I turned "European short date" in DataFrame 1 and "Date" in Dataframe 2 to be index fields and though about approaching my goal through "for" loop. I tried to turn "European short date" to be "List" to use it to iterate through the dataframe 1, but I get the following error: "/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:18: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead".
Here is my code so far:
Main_set = pd.read_excel('...')
Main_set = pd.DataFrame(Main_set)
Main_set['European short date'] = pd.to_datetime(Main_set['European short date'], format='%d.%m.%y', errors='coerce').dt.strftime('%Y-%m-%d')
Main_set = Main_set.set_index('European short date')
Main_set.head(5)
Indexes = pd.read_excel('...')
Indexes = pd.DataFrame(Indexes)
Indexes['Date'] = pd.to_datetime(Indexes['Date'], format='%d.%m.%y', errors='coerce').dt.strftime('%Y-%m-%d')
Indexes = Indexes.set_index('Date')
SP1500DailyReturns = Indexes[['S&P 1500 SUPER COMPOSITE - PRICE INDEX']]
SP1500DailyReturns['S&P 1500_return'] = (SP1500DailyReturns['S&P 1500 SUPER COMPOSITE - PRICE INDEX'] / SP1500DailyReturns['S&P 1500 SUPER COMPOSITE - PRICE INDEX'].shift(1))
SP1500DailyReturns.to_csv('...')
Main_set['SP50030after'] = np.zeros(326)
import math
dates = Main_set['European short date'].to_list()
dates.head()
for n in dates:
Main_set['SP50030after'] = math.prod(arr)
Many thanks in advance!
In case it will be useful for someone, I solved the problem by using a for loop and dividing the problem in more steps:
for n in dates:
Date = pd.Timestamp(n)
DateB4 = Date - pd.Timedelta("365 days")
DateAfter = Date + pd.Timedelta("30 days")
ReturnsofPeriodsBackwards = SP1500DailyReturns.loc[str(DateB4) : str(Date), 'S&P 1500_return']
Main_set.loc[str(Date), 'SP500365before'] = np.prod(ReturnsofPeriodsBackwards)
ReturnsofPeriodsForward = SP1500DailyReturns.loc[str(Date) : str(DateAfter), 'S&P 1500_return']
Main_set.loc[str(Date), 'SP50030after'] = np.prod(ReturnsofPeriodsForward)
I'm trying to set up a filter in excel where the resulting data should include both criteria which are contradicting.
Example:
Set 1
Field =2 ,Criteria1 =x field = 3 criteria= 1
Set 2
Field =2 ,Criteria1 <>x field = 3 criteria= 2
Where the end result is all rows which satisfy either set of conditions
Any help would be appreciated.
Thanks
I've got a "Day" filter in a Pivot table with the past 6 months, in the following format: "2/23/2016". Those values will change every day as I add more days, but I need a VBA script to select the first 30 values starting from the bottom. I can hard code "Filter "2/23/2016", but I want to dynamically select "The first 30 from the bottom" no matter what they are. Screenshot for some clarity:
ActiveSheet.PivotTables("PivotTable1").PivotFields("Day").CurrentPage = "(All)"
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Day")
c = 5
For i = .PivotItems.Count To 1 Step -1
If (c > 0) Then
.PivotItems(i).Visible = True
Else
.PivotItems(i).Visible = False
End If
c = c - 1
Next
End With
I solved it. Here it is. C is how many values from the bottom you want to make visible.