Need for Funds (NFO) and Working Capital (WC) Calculations

I calculate the Need for Funds and Working Capital for a number of companies and analyse the results

Corporate Finance and Managerial Finance

I created a script to download any company from Yahoo Finance and compute the DuPont, Need for Funds and Working Capital based on companies fundamentals and plot these for each company. I suggest you first watch these two short videos from IESE Business School - part 1 here and part 2 here.

Firstly load in some packages:

library(knitr)
library(kableExtra)
library(tidyquant)
library(quantmod)
library(tibble)
library(tidyr)
library(reshape2)
library(ggplot2)
library(rvest)

I first define the function to scrape Yahoo Finance and collect the Balance Sheet, Income Statement and Cash Flows (it looks complicated but it works):

getFin <- function(stock){
  for (i in 1:length(stock)) {
    tryCatch(
      {
        # Collect the Income Statement data
        link <- "https://finance.yahoo.com/quote/"
        link <- paste0(link, stock[i], "/financials?p=", stock[i])
        wahis.session <- html_session(link)
        p <- wahis.session %>%
          html_nodes(xpath = '//*[@id="Col1-1-Financials-Proxy"]/section/div[3]/table')%>%
          html_table(fill = TRUE)
        IncomeStatement <- p[[1]]
        colnames(IncomeStatement) <- paste(IncomeStatement[1,])
        IncomeStatement <- IncomeStatement[-c(1,5,12,20,25),]
        names_row <- paste(IncomeStatement[,1])
        IncomeStatement <- IncomeStatement[,-1]
        IncomeStatement <- apply(IncomeStatement, 2, function(x){gsub(",","",x)})
        IncomeStatement <- as.data.frame(apply(IncomeStatement, 2, as.numeric))
        rownames(IncomeStatement) <- paste(names_row)
        temp1 <- IncomeStatement
        
        # Collect the Balance Sheet data
        link <- "https://finance.yahoo.com/quote/"
        link <- paste0(link, stock[i],"/balance-sheet?p=", stock[i])
        wahis.session <- html_session(link)
        p <- wahis.session %>%
          html_nodes(xpath = '//*[@id="Col1-1-Financials-Proxy"]/section/div[3]/table')%>%
          html_table(fill = TRUE)
        BalanceSheet <- p[[1]]
        colnames(BalanceSheet) <- BalanceSheet[1,]
        BalanceSheet <- BalanceSheet[-c(1,2,17,28),]
        names_row <- BalanceSheet[,1]
        BalanceSheet <- BalanceSheet[,-1]
        BalanceSheet <- apply(BalanceSheet, 2, function(x){gsub(",","",x)})
        BalanceSheet <- as.data.frame(apply(BalanceSheet, 2, as.numeric))
        rownames(BalanceSheet) <- paste(names_row)
        temp2 <- BalanceSheet
        
        # Collect the Cash Flow data
        link <- "https://finance.yahoo.com/quote/"
        link <- paste0(link, stock[i], "/cash-flow?p=", stock[i])
        wahis.session <- html_session(link)
        p <- wahis.session %>%
          html_nodes(xpath = '//*[@id="Col1-1-Financials-Proxy"]/section/div[3]/table')%>%
          html_table(fill = TRUE)
        CashFlow <- p[[1]]
        colnames(CashFlow) <- CashFlow[1,]
        CashFlow <- CashFlow[-c(1,3,11,16),]
        names_row <- CashFlow[,1]
        CashFlow <- CashFlow[,-1]
        CashFlow <- apply(CashFlow, 2, function(x){gsub(",","",x)})
        CashFlow <- as.data.frame(apply(CashFlow, 2, as.numeric))
        rownames(CashFlow) <- paste(names_row)
        temp3 <- CashFlow
        
        assign(paste0(stock[i],'.f'),value = list(IncomeStatement = temp1, BalanceSheet = temp2, CashFlow = temp3), envir = parent.frame())
        },
      error = function(cond){
        message(stock[i], "Give error ",cond)
        }
      )
  }
}

Next I collect some tickers, I choose Ford, General Electric, International Business Machine and Unilever but feel free to add in more tickers - what ever financial data can be found on Yahoo Finance will work- just add to the symbols part of the code.

symbols <- c("F", "GE", "IBM", "UN")
getFin(symbols)
symbols.f <- sapply(symbols, function(x) { paste0(x, ".f") })

tickers <- list2env(mget(symbols.f))

IS <- lapply(tickers, "[[", "IncomeStatement")
BS <- lapply(tickers, "[[", "BalanceSheet")
CF <- lapply(tickers, "[[", "CashFlow")

IS <- as.data.frame(IS)
BS <- as.data.frame(BS)
CF <- as.data.frame(CF)

Where IS is Income Statement, BS is Balance SheetandCF` is Cash Flow.

How the Income Statement looks:

Table 1: Income Statement
UN.f.12.31.2018 UN.f.12.31.2017 UN.f.12.31.2016 UN.f.12.31.2015 IBM.f.12.31.2018 IBM.f.12.31.2017 IBM.f.12.31.2016 IBM.f.12.31.2015 GE.f.12.31.2018 GE.f.12.31.2017 GE.f.12.31.2016 GE.f.12.31.2015 F.f.12.31.2018 F.f.12.31.2017 F.f.12.31.2016 F.f.12.31.2015
Total Revenue 50982000 53715000 52713000 53272000 79591000 79139000 79919000 81741000 121615000 118243000 119468000 115834000 160338000 156776000 151800000 149558000
Cost of Revenue 28769000 30547000 30229000 30808000 42655000 42196000 41402000 41057000 98396000 106858000 94886000 90111000 145459000 140218000 134933000 131410000
Gross Profit 22213000 23168000 22484000 22464000 36936000 36943000 38517000 40684000 23219000 11385000 24582000 25723000 14879000 16558000 16867000 18148000
Research Development 900000 900000 978000 1005000 5379000 5590000 5726000 5247000 NA NA NA NA NA NA NA NA
Selling General and Administrative 8803000 13507000 13799000 14065000 20325000 20900000 20225000 19589000 15134000 15389000 14707000 16327000 10460000 9676000 12504000 10097000
Non Recurring NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Others 41427000 44031000 44031000 44031000 -998000 -1445000 -1604000 -669000 NA NA NA NA NA NA NA NA
Total Operating Expenses 38472000 44954000 45006000 45878000 67361000 67241000 65749000 65224000 113530000 122247000 109593000 106438000 155919000 149894000 147437000 141507000
Operating Income or Loss 12510000 8761000 7707000 7394000 12230000 11898000 14170000 16517000 8085000 -4004000 9875000 9396000 4419000 6882000 4363000 8051000
Total Other Income/Expenses Net -127000 -608000 -238000 -174000 -888000 -498000 -1840000 -572000 -28220000 -7147000 -2843000 -1211000 -74000 1277000 2421000 2201000
Earnings Before Interest and Taxes 12510000 8761000 7707000 7394000 12230000 11898000 14170000 16517000 8085000 -4004000 9875000 9396000 4419000 6882000 4363000 8051000
Interest Expense -627000 -608000 -572000 -552000 -723000 -615000 -630000 -468000 -2708000 -2753000 -2026000 -1706000 -1228000 -1190000 -951000 -773000
Income Before Tax 12383000 8153000 7469000 7220000 11342000 11400000 12330000 15945000 -20135000 -11151000 7032000 8185000 4345000 8159000 6784000 10252000
Income Tax Expense 2575000 1667000 1922000 1961000 2619000 5642000 449000 2581000 583000 -2611000 -1133000 6485000 650000 402000 2184000 2881000
Minority Interest 720000 758000 626000 643000 134000 131000 146000 162000 20882000 20859000 4688000 4836000 134000 126000 113000 109000
Net Income From Continuing Ops 9808000 6486000 5547000 5259000 8723000 5758000 11881000 13364000 -20718000 -8540000 8165000 1700000 3695000 7757000 4600000 7371000
Discontinued Operations NA NA NA NA 5000 -5000 -9000 -174000 -1726000 -309000 -954000 -7807000 NA NA NA NA
Extraordinary Items NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Effect Of Accounting Changes NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Other Items NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Net Income 9389000 6053000 5184000 4909000 8728000 5753000 11872000 13190000 -22355000 -8484000 7500000 -6126000 3677000 7731000 4589000 7373000
Preferred Stock And Other Adjustments NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Net Income Applicable To Common Shares 9389000 6053000 5184000 4909000 8728000 5753000 11872000 13190000 -22809000 -8944000 6829000 -6135000 3677000 7731000 4589000 7373000

How the Balance Sheet looks:

Table 2: Balance Sheet
UN.f.12.31.2018 UN.f.12.31.2017 UN.f.12.31.2016 UN.f.12.31.2015 IBM.f.12.31.2018 IBM.f.12.31.2017 IBM.f.12.31.2016 IBM.f.12.31.2015 GE.f.12.31.2018 GE.f.12.31.2017 GE.f.12.31.2016 GE.f.12.31.2015 F.f.12.31.2018 F.f.12.31.2017 F.f.12.31.2016 F.f.12.31.2015
Cash And Cash Equivalents 3230000 3317000 3382000 2302000 11379000 11972000 7826000 7686000 16369000 18211000 10525000 10372000 7111000 8934000 7828000 5386000
Short Term Investments 681000 521000 565000 596000 618000 608000 701000 508000 NA NA NA NA 15925000 17554000 19642000 18181000
Net Receivables 4822000 4204000 3854000 3416000 8596000 10380000 10239000 9534000 19874000 24209000 24076000 43013000 3698000 10599000 11102000 11042000
Inventory 4301000 3962000 4278000 4335000 1682000 1583000 1553000 1551000 19271000 19419000 22354000 22515000 11220000 11176000 8898000 8319000
Other Current Assets 1387000 4356000 1120000 1352000 2902000 2266000 532000 293000 7441000 6720000 3885000 5109000 2567000 3649000 3145000 2704000
Total Current Assets 15481000 16983000 13884000 12686000 49146000 49735000 43889000 42504000 95974000 116253000 131436000 280896000 114649000 116801000 108461000 102587000
Long Term Investments 637000 565000 491000 592000 439000 581000 659000 1131000 34920000 38696000 44313000 31973000 2595000 3448000 3523000 3244000
Property, plant and equipment 10347000 10411000 11673000 11058000 10792000 11116000 10830000 10727000 50749000 53874000 50518000 54095000 37883000 36901000 33692000 32177000
Goodwill 17341000 16881000 17624000 16213000 36265000 36788000 36199000 32021000 58710000 83968000 68070000 65526000 264000 75000 50000 6000
Intangible Assets 12152000 11520000 9809000 8846000 3087000 3742000 4688000 3487000 18159000 20273000 16436000 17797000 178000 213000 198000 124000
Accumulated Amortization NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Other Assets 3498000 3925000 2948000 2903000 14505000 13844000 12184000 10612000 49713000 56181000 52042000 42784000 16755000 18215000 14894000 16154000
Deferred Long Term Asset Charges 1117000 1085000 1354000 1185000 5216000 4862000 5224000 4822000 12432000 8819000 1833000 3105000 10412000 10762000 9705000 11509000
Total Assets 59456000 60285000 56429000 52298000 123382000 125356000 117470000 110495000 309129000 369245000 365183000 493071000 256540000 258496000 237951000 224925000
Accounts Payable 9121000 8217000 8591000 8296000 6558000 6451000 6209000 6028000 17153000 15172000 14435000 13680000 20426000 23282000 21296000 20272000
Short/Current Long Term Debt 2012000 1537000 2173000 1495000 7055000 5215000 6239000 5271000 NA NA NA NA 1700000 1960000 1361000 961000
Other Current Liabilities 3194000 2787000 2392000 2759000 14680000 16451000 14693000 14281000 19710000 19531000 20772000 27453000 18868000 16402000 16277000 16084000
Total Current Liabilities 19772000 23177000 20556000 20019000 38227000 37363000 36275000 34269000 49937000 60043000 70364000 138270000 95569000 94600000 90281000 82336000
Long Term Debt 21535000 16342000 11011000 9696000 35681000 39871000 34663000 33431000 95234000 108575000 105080000 144659000 11833000 13174000 13222000 11060000
Other Liabilities 5742000 6259000 7748000 6343000 32544000 30397000 28140000 28371000 74883000 84243000 83040000 79175000 23088000 25526000 25086000 23959000
Deferred Long Term Liability Charges NA NA NA NA 2676000 2136000 1496000 1626000 5739000 5484000 5534000 NA NA 232000 NA NA
Minority Interest 720000 758000 626000 643000 134000 131000 146000 162000 20882000 20859000 4688000 4836000 134000 126000 113000 109000
Negative Goodwill NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Total Liabilities 47164000 45898000 39449000 36216000 106452000 107631000 99078000 96071000 257266000 292356000 284667000 389961000 220474000 222792000 208668000 196174000
Misc. Stocks Options Warrants NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Redeemable Preferred Stock NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Preferred Stock NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Common Stock 464000 484000 484000 484000 55151000 54566000 53935000 53262000 702000 702000 702000 702000 41000 41000 41000 41000
Retained Earnings 26265000 26648000 23179000 22619000 159206000 153126000 152759000 146124000 93109000 117245000 139532000 140020000 22668000 21906000 15634000 14414000
Treasury Stock -15286000 -13633000 -7443000 -7816000 -197561000 -190098000 -188448000 -185124000 -62836000 -61923000 -64412000 -42454000 -8783000 -8212000 -8135000 -7234000
Capital Surplus 129000 130000 134000 152000 NA NA NA NA NA NA NA NA 22006000 21843000 21630000 21421000
Other Stockholder Equity -5105000 -4425000 -3279000 -3697000 -29490000 -26591000 -29398000 -29606000 21089000 22979000 18626000 21085000 -7366000 -6959000 -7013000 -6257000
Total stockholders’ equity 11572000 13629000 16354000 15439000 16796000 17594000 18246000 14262000 30975000 56024000 75822000 98268000 35932000 35578000 29170000 28642000
Net Tangible Assets -17921000 -14772000 -11079000 -9620000 -22556000 -22936000 -22641000 -21246000 -46798000 -48217000 -11052000 14945000 35932000 35290000 28922000 28512000

How the Cash Flow Statement looks:

Table 3: Cash Flow Statements
UN.f.12.31.2018 UN.f.12.31.2017 UN.f.12.31.2016 UN.f.12.31.2015 IBM.f.12.31.2018 IBM.f.12.31.2017 IBM.f.12.31.2016 IBM.f.12.31.2015 GE.f.12.31.2018 GE.f.12.31.2017 GE.f.12.31.2016 GE.f.12.31.2015 F.f.12.31.2018 F.f.12.31.2017 F.f.12.31.2016 F.f.12.31.2015
Net Income 9389000 6053000 5184000 4909000 8728000 5753000 11872000 13190000 -22355000 -8484000 7500000 -6126000 3677000 7731000 4589000 7373000
Depreciation 1450000 1214000 1464000 1370000 4480000 4541000 4381000 3855000 7796000 7429000 7070000 6509000 8308000 8453000 8717000 7966000
Adjustments To Net Income -3590000 -231000 348000 331000 1485000 -383000 -526000 2406000 18532000 9305000 -14391000 21411000 -677000 -910000 3607000 -2153000
Changes In Accounts Receivables -1298000 -506000 142000 2000 1006000 1297000 712000 812000 -430000 -2846000 1460000 -52000 -2239000 -2297000 -2855000 -3563000
Changes In Liabilities 976000 542000 -281000 847000 126000 47000 197000 81000 1697000 1343000 2953000 -1537000 6781000 6089000 6595000 7758000
Changes In Inventories -471000 -104000 190000 -129000 -127000 18000 -14000 133000 -902000 1183000 -815000 -314000 -828000 -970000 -803000 -1155000
Changes In Other Operating Activities -793000 -68000 -68000 -68000 -451000 5451000 462000 -3222000 -92000 -1898000 -2617000 -2617000 NA NA NA NA
Total Cash Flow From Operating Activities 6753000 7292000 7047000 7330000 15247000 16724000 17084000 17255000 4246000 6032000 1160000 19891000 15022000 18096000 19850000 16226000
Capital Expenditure -1329000 -1509000 -1804000 -1867000 -3395000 -3229000 -3567000 -3579000 -7695000 -7371000 -7199000 -7309000 -7785000 -7049000 -6992000 -7196000
Investments 47000 -215000 100000 -62000 -554000 -1039000 -161000 -231000 NA NA NA NA 3387000 2331000 -2074000 -513000
Other Cash flows from Investing Activities 264000 292000 291000 295000 -1000 -1000 -1000 1000 12953000 10133000 -10317000 -5316000 181000 71000 937000 634000
Total Cash Flows From Investing Activities 4644000 -5879000 -3188000 -3539000 -4913000 -7081000 -10928000 -8159000 18239000 6564000 49135000 59488000 -16261000 -19360000 -25302000 -26162000
Dividends Paid -4066000 -3916000 -3609000 -3331000 -5666000 -5506000 -5256000 -4897000 -4474000 -8650000 -8806000 -9295000 -2705000 -2384000 -2383500 -2380000
Sale Purchase of Stock NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Net Borrowings -35000 8928000 1771000 1527000 -301000 3447000 2763000 19000 -22401000 -8952000 -58411000 -57546000 3139000 6260000 11028000 17148000
Other Cash Flows from Financing Activities -1170000 -1227000 -978000 -952000 112000 174000 204000 -1000 -4141000 1006000 -1818000 -8114000 -192000 -151000 -107000 -373000
Total Cash Flows From Financing Activities -11548000 -1433000 -3073000 -3032000 -10469000 -6418000 -5917000 -9413000 -31033000 -19146000 -90464000 -76054000 -122000 3394000 7400000 14266000
Effect Of Exchange Rate Changes 72000 -9000 284000 -541000 -495000 937000 -51000 -473000 -628000 891000 -1146000 -3464000 -370000 489000 -265000 -815000
Change In Cash and Cash Equivalents -79000 -29000 1070000 218000 -630000 4161000 188000 -790000 -9176000 -5660000 -41315000 -138000 -1731000 2619000 1683000 3515000

As in previous posts let’s clean the data up and put it into a better format which is easier for computations.

############# Combine and clean the data ###############

ISBSCF <- rbind(IS, BS, CF)

ISBSCF <- ISBSCF %>%
  t() %>%
  data.frame() %>%
  rownames_to_column('rn') %>%
  separate(rn, into = c("symbol", "year"),
           sep = -4, convert = TRUE)


ISBSCF$symbol <- gsub("(f).*", "", ISBSCF$symbol)
ISBSCF$symbol <- gsub('.$', '', ISBSCF$symbol)
ISBSCF$symbol <- gsub('^X', '', ISBSCF$symbol)

How the full data looks:

Table 4: Income Statment - Balance Sheet - Cash Flow
symbol year Total.Revenue Cost.of.Revenue Gross.Profit Research.Development Selling.General.and.Administrative Non.Recurring Others Total.Operating.Expenses Operating.Income.or.Loss Total.Other.Income.Expenses.Net Earnings.Before.Interest.and.Taxes Interest.Expense Income.Before.Tax Income.Tax.Expense Minority.Interest Net.Income.From.Continuing.Ops Discontinued.Operations Extraordinary.Items Effect.Of.Accounting.Changes Other.Items Net.Income Preferred.Stock.And.Other.Adjustments Net.Income.Applicable.To.Common.Shares Cash.And.Cash.Equivalents Short.Term.Investments Net.Receivables Inventory Other.Current.Assets Total.Current.Assets Long.Term.Investments Property..plant.and.equipment Goodwill Intangible.Assets Accumulated.Amortization Other.Assets Deferred.Long.Term.Asset.Charges Total.Assets Accounts.Payable Short.Current.Long.Term.Debt Other.Current.Liabilities Total.Current.Liabilities Long.Term.Debt Other.Liabilities Deferred.Long.Term.Liability.Charges Minority.Interest1 Negative.Goodwill Total.Liabilities Misc..Stocks.Options.Warrants Redeemable.Preferred.Stock Preferred.Stock Common.Stock Retained.Earnings Treasury.Stock Capital.Surplus Other.Stockholder.Equity Total.stockholders..equity Net.Tangible.Assets Net.Income1 Depreciation Adjustments.To.Net.Income Changes.In.Accounts.Receivables Changes.In.Liabilities Changes.In.Inventories Changes.In.Other.Operating.Activities Total.Cash.Flow.From.Operating.Activities Capital.Expenditure Investments Other.Cash.flows.from.Investing.Activities Total.Cash.Flows.From.Investing.Activities Dividends.Paid Sale.Purchase.of.Stock Net.Borrowings Other.Cash.Flows.from.Financing.Activities Total.Cash.Flows.From.Financing.Activities Effect.Of.Exchange.Rate.Changes Change.In.Cash.and.Cash.Equivalents
UN 2018 50982000 28769000 22213000 900000 8803000 NA 41427000 38472000 12510000 -127000 12510000 -627000 12383000 2575000 720000 9808000 NA NA NA NA 9389000 NA 9389000 3230000 681000 4822000 4301000 1387000 15481000 637000 10347000 17341000 12152000 NA 3498000 1117000 59456000 9121000 2012000 3194000 19772000 21535000 5742000 NA 720000 NA 47164000 NA NA NA 464000 26265000 -15286000 129000 -5105000 11572000 -17921000 9389000 1450000 -3590000 -1298000 976000 -471000 -793000 6753000 -1329000 47000 264000 4644000 -4066000 NA -35000 -1170000 -11548000 72000 -79000
UN 2017 53715000 30547000 23168000 900000 13507000 NA 44031000 44954000 8761000 -608000 8761000 -608000 8153000 1667000 758000 6486000 NA NA NA NA 6053000 NA 6053000 3317000 521000 4204000 3962000 4356000 16983000 565000 10411000 16881000 11520000 NA 3925000 1085000 60285000 8217000 1537000 2787000 23177000 16342000 6259000 NA 758000 NA 45898000 NA NA NA 484000 26648000 -13633000 130000 -4425000 13629000 -14772000 6053000 1214000 -231000 -506000 542000 -104000 -68000 7292000 -1509000 -215000 292000 -5879000 -3916000 NA 8928000 -1227000 -1433000 -9000 -29000
UN 2016 52713000 30229000 22484000 978000 13799000 NA 44031000 45006000 7707000 -238000 7707000 -572000 7469000 1922000 626000 5547000 NA NA NA NA 5184000 NA 5184000 3382000 565000 3854000 4278000 1120000 13884000 491000 11673000 17624000 9809000 NA 2948000 1354000 56429000 8591000 2173000 2392000 20556000 11011000 7748000 NA 626000 NA 39449000 NA NA NA 484000 23179000 -7443000 134000 -3279000 16354000 -11079000 5184000 1464000 348000 142000 -281000 190000 -68000 7047000 -1804000 100000 291000 -3188000 -3609000 NA 1771000 -978000 -3073000 284000 1070000
UN 2015 53272000 30808000 22464000 1005000 14065000 NA 44031000 45878000 7394000 -174000 7394000 -552000 7220000 1961000 643000 5259000 NA NA NA NA 4909000 NA 4909000 2302000 596000 3416000 4335000 1352000 12686000 592000 11058000 16213000 8846000 NA 2903000 1185000 52298000 8296000 1495000 2759000 20019000 9696000 6343000 NA 643000 NA 36216000 NA NA NA 484000 22619000 -7816000 152000 -3697000 15439000 -9620000 4909000 1370000 331000 2000 847000 -129000 -68000 7330000 -1867000 -62000 295000 -3539000 -3331000 NA 1527000 -952000 -3032000 -541000 218000
IBM 2018 79591000 42655000 36936000 5379000 20325000 NA -998000 67361000 12230000 -888000 12230000 -723000 11342000 2619000 134000 8723000 5000 NA NA NA 8728000 NA 8728000 11379000 618000 8596000 1682000 2902000 49146000 439000 10792000 36265000 3087000 NA 14505000 5216000 123382000 6558000 7055000 14680000 38227000 35681000 32544000 2676000 134000 NA 106452000 NA NA NA 55151000 159206000 -197561000 NA -29490000 16796000 -22556000 8728000 4480000 1485000 1006000 126000 -127000 -451000 15247000 -3395000 -554000 -1000 -4913000 -5666000 NA -301000 112000 -10469000 -495000 -630000
IBM 2017 79139000 42196000 36943000 5590000 20900000 NA -1445000 67241000 11898000 -498000 11898000 -615000 11400000 5642000 131000 5758000 -5000 NA NA NA 5753000 NA 5753000 11972000 608000 10380000 1583000 2266000 49735000 581000 11116000 36788000 3742000 NA 13844000 4862000 125356000 6451000 5215000 16451000 37363000 39871000 30397000 2136000 131000 NA 107631000 NA NA NA 54566000 153126000 -190098000 NA -26591000 17594000 -22936000 5753000 4541000 -383000 1297000 47000 18000 5451000 16724000 -3229000 -1039000 -1000 -7081000 -5506000 NA 3447000 174000 -6418000 937000 4161000
IBM 2016 79919000 41402000 38517000 5726000 20225000 NA -1604000 65749000 14170000 -1840000 14170000 -630000 12330000 449000 146000 11881000 -9000 NA NA NA 11872000 NA 11872000 7826000 701000 10239000 1553000 532000 43889000 659000 10830000 36199000 4688000 NA 12184000 5224000 117470000 6209000 6239000 14693000 36275000 34663000 28140000 1496000 146000 NA 99078000 NA NA NA 53935000 152759000 -188448000 NA -29398000 18246000 -22641000 11872000 4381000 -526000 712000 197000 -14000 462000 17084000 -3567000 -161000 -1000 -10928000 -5256000 NA 2763000 204000 -5917000 -51000 188000
IBM 2015 81741000 41057000 40684000 5247000 19589000 NA -669000 65224000 16517000 -572000 16517000 -468000 15945000 2581000 162000 13364000 -174000 NA NA NA 13190000 NA 13190000 7686000 508000 9534000 1551000 293000 42504000 1131000 10727000 32021000 3487000 NA 10612000 4822000 110495000 6028000 5271000 14281000 34269000 33431000 28371000 1626000 162000 NA 96071000 NA NA NA 53262000 146124000 -185124000 NA -29606000 14262000 -21246000 13190000 3855000 2406000 812000 81000 133000 -3222000 17255000 -3579000 -231000 1000 -8159000 -4897000 NA 19000 -1000 -9413000 -473000 -790000
GE 2018 121615000 98396000 23219000 NA 15134000 NA NA 113530000 8085000 -28220000 8085000 -2708000 -20135000 583000 20882000 -20718000 -1726000 NA NA NA -22355000 NA -22809000 16369000 NA 19874000 19271000 7441000 95974000 34920000 50749000 58710000 18159000 NA 49713000 12432000 309129000 17153000 NA 19710000 49937000 95234000 74883000 5739000 20882000 NA 257266000 NA NA NA 702000 93109000 -62836000 NA 21089000 30975000 -46798000 -22355000 7796000 18532000 -430000 1697000 -902000 -92000 4246000 -7695000 NA 12953000 18239000 -4474000 NA -22401000 -4141000 -31033000 -628000 -9176000
GE 2017 118243000 106858000 11385000 NA 15389000 NA NA 122247000 -4004000 -7147000 -4004000 -2753000 -11151000 -2611000 20859000 -8540000 -309000 NA NA NA -8484000 NA -8944000 18211000 NA 24209000 19419000 6720000 116253000 38696000 53874000 83968000 20273000 NA 56181000 8819000 369245000 15172000 NA 19531000 60043000 108575000 84243000 5484000 20859000 NA 292356000 NA NA NA 702000 117245000 -61923000 NA 22979000 56024000 -48217000 -8484000 7429000 9305000 -2846000 1343000 1183000 -1898000 6032000 -7371000 NA 10133000 6564000 -8650000 NA -8952000 1006000 -19146000 891000 -5660000
GE 2016 119468000 94886000 24582000 NA 14707000 NA NA 109593000 9875000 -2843000 9875000 -2026000 7032000 -1133000 4688000 8165000 -954000 NA NA NA 7500000 NA 6829000 10525000 NA 24076000 22354000 3885000 131436000 44313000 50518000 68070000 16436000 NA 52042000 1833000 365183000 14435000 NA 20772000 70364000 105080000 83040000 5534000 4688000 NA 284667000 NA NA NA 702000 139532000 -64412000 NA 18626000 75822000 -11052000 7500000 7070000 -14391000 1460000 2953000 -815000 -2617000 1160000 -7199000 NA -10317000 49135000 -8806000 NA -58411000 -1818000 -90464000 -1146000 -41315000
GE 2015 115834000 90111000 25723000 NA 16327000 NA NA 106438000 9396000 -1211000 9396000 -1706000 8185000 6485000 4836000 1700000 -7807000 NA NA NA -6126000 NA -6135000 10372000 NA 43013000 22515000 5109000 280896000 31973000 54095000 65526000 17797000 NA 42784000 3105000 493071000 13680000 NA 27453000 138270000 144659000 79175000 NA 4836000 NA 389961000 NA NA NA 702000 140020000 -42454000 NA 21085000 98268000 14945000 -6126000 6509000 21411000 -52000 -1537000 -314000 -2617000 19891000 -7309000 NA -5316000 59488000 -9295000 NA -57546000 -8114000 -76054000 -3464000 -138000
F 2018 160338000 145459000 14879000 NA 10460000 NA NA 155919000 4419000 -74000 4419000 -1228000 4345000 650000 134000 3695000 NA NA NA NA 3677000 NA 3677000 7111000 15925000 3698000 11220000 2567000 114649000 2595000 37883000 264000 178000 NA 16755000 10412000 256540000 20426000 1700000 18868000 95569000 11833000 23088000 NA 134000 NA 220474000 NA NA NA 41000 22668000 -8783000 22006000 -7366000 35932000 35932000 3677000 8308000 -677000 -2239000 6781000 -828000 NA 15022000 -7785000 3387000 181000 -16261000 -2705000 NA 3139000 -192000 -122000 -370000 -1731000
F 2017 156776000 140218000 16558000 NA 9676000 NA NA 149894000 6882000 1277000 6882000 -1190000 8159000 402000 126000 7757000 NA NA NA NA 7731000 NA 7731000 8934000 17554000 10599000 11176000 3649000 116801000 3448000 36901000 75000 213000 NA 18215000 10762000 258496000 23282000 1960000 16402000 94600000 13174000 25526000 232000 126000 NA 222792000 NA NA NA 41000 21906000 -8212000 21843000 -6959000 35578000 35290000 7731000 8453000 -910000 -2297000 6089000 -970000 NA 18096000 -7049000 2331000 71000 -19360000 -2384000 NA 6260000 -151000 3394000 489000 2619000
F 2016 151800000 134933000 16867000 NA 12504000 NA NA 147437000 4363000 2421000 4363000 -951000 6784000 2184000 113000 4600000 NA NA NA NA 4589000 NA 4589000 7828000 19642000 11102000 8898000 3145000 108461000 3523000 33692000 50000 198000 NA 14894000 9705000 237951000 21296000 1361000 16277000 90281000 13222000 25086000 NA 113000 NA 208668000 NA NA NA 41000 15634000 -8135000 21630000 -7013000 29170000 28922000 4589000 8717000 3607000 -2855000 6595000 -803000 NA 19850000 -6992000 -2074000 937000 -25302000 -2383500 NA 11028000 -107000 7400000 -265000 1683000
F 2015 149558000 131410000 18148000 NA 10097000 NA NA 141507000 8051000 2201000 8051000 -773000 10252000 2881000 109000 7371000 NA NA NA NA 7373000 NA 7373000 5386000 18181000 11042000 8319000 2704000 102587000 3244000 32177000 6000 124000 NA 16154000 11509000 224925000 20272000 961000 16084000 82336000 11060000 23959000 NA 109000 NA 196174000 NA NA NA 41000 14414000 -7234000 21421000 -6257000 28642000 28512000 7373000 7966000 -2153000 -3563000 7758000 -1155000 NA 16226000 -7196000 -513000 634000 -26162000 -2380000 NA 17148000 -373000 14266000 -815000 3515000

Now that we have the full data, we can perform any number of calculations across different financial statements. Now the companies are in the “rows” and the “columns” consist of thefinancial entires.

Some calculations are necessary for computing the NFO.

Compute the Cash Flow Cycle

########## Create the Cash Cycle Calculations #############

#Set CashCycle data.frame up
CashCycle <- data.frame(matrix("", nrow = nrow(ISBSCF)))
CashCycle[,1] <- NULL
CashCycle$Ticker <- ISBSCF$symbol
CashCycle$Date <- ISBSCF$year

#CashCycle excluding accured expense Calculations
CashCycle$CollectionPeriod <- (ISBSCF$Net.Receivables / ISBSCF$Total.Revenue) * 365
CashCycle$DaysofInventory <- (ISBSCF$Inventory / ISBSCF$Cost.of.Revenue) * 365
CashCycle$DaysofPayable <- (ISBSCF$Accounts.Payable / ISBSCF$Cost.of.Revenue) * 365
CashCycle$CashCollectionCycle <- CashCycle$CollectionPeriod + CashCycle$DaysofInventory - CashCycle$DaysofPayable
#CashCycle including accured expense Calculations
CashCycle$DaysofPayableAccExp <- ((ISBSCF$Accounts.Payable + ISBSCF$Total.Current.Liabilities) / ISBSCF$Cost.of.Revenue) * 365
CashCycle$CashCollectionCycleAccExp <- CashCycle$CollectionPeriod + CashCycle$DaysofInventory - CashCycle$DaysofPayableAccExp

CashCycle <- CashCycle[Reduce(`&`, lapply(CashCycle, function(x) !is.nan(x)  & !is.infinite(x))),]
Table 5: Cash Flow Cycle
Ticker Date CollectionPeriod DaysofInventory DaysofPayable CashCollectionCycle DaysofPayableAccExp CashCollectionCycleAccExp
UN 2018 34.522577 54.56794 115.72057 -26.630053 366.5732 -277.4827
UN 2017 28.566695 47.34115 98.18329 -22.275450 375.1206 -299.2128
UN 2016 26.686206 51.65470 103.73201 -25.391103 351.9354 -273.5945
UN 2015 23.405166 51.35922 98.28746 -23.523067 335.4640 -260.6996
IBM 2018 39.420789 14.39292 56.11699 -2.303276 383.2265 -329.4128
IBM 2017 47.873994 13.69312 55.80185 5.765263 378.9959 -317.4288
IBM 2016 46.762785 13.69125 54.73854 5.715492 374.5389 -314.0849
IBM 2015 42.572393 13.78851 53.58940 2.771507 358.2435 -301.8826
GE 2018 59.647330 71.48578 63.62906 67.504052 248.8704 -117.7373
GE 2017 74.729878 66.33041 51.82373 89.236560 256.9155 -115.8552
GE 2016 73.557271 85.98961 55.52742 104.019457 326.1981 -166.6512
GE 2015 135.536587 91.19836 55.41166 171.323283 615.4826 -388.7476
F 2018 8.418279 28.15433 51.25492 -14.682320 291.0660 -254.4934
F 2017 24.676194 29.09213 60.60513 -6.836807 306.8574 -253.0891
F 2016 26.694532 24.06950 57.60666 -6.842631 301.8209 -251.0569
F 2015 26.948274 23.10657 56.30683 -6.251977 285.0005 -234.9457

Where all the results are in days. So Unilever 2018, CollectionPeriod was 34.5 days, up from their 2017, CollectionPeriod and up annually since 2015. Wheras Ford has been decreasing their CollectionPeriod over the sample period.

Let us continue with some DuPont analysis…

########## Create the DuPont Calculations #############

#DuPont Analysis
#Set CashCycle data.frame up
DuPontAnalysis <- data.frame(matrix("", nrow = nrow(ISBSCF)))
DuPontAnalysis[,1] <- NULL
DuPontAnalysis$Ticker <- ISBSCF$symbol
DuPontAnalysis$Date <- ISBSCF$year
#DuPont Analysis Calculations
DuPontAnalysis$ROE <- ISBSCF$Net.Income / ISBSCF$Total.stockholders..equity
DuPontAnalysis$ROS <- ISBSCF$Net.Income / ISBSCF$Total.Revenue
DuPontAnalysis$Turnover <- ISBSCF$Total.Revenue / ISBSCF$Total.Assets
DuPontAnalysis$Leverage <- ISBSCF$Total.Assets / ISBSCF$Total.stockholders..equity

DuPontAnalysis <- DuPontAnalysis[Reduce(`&`, lapply(DuPontAnalysis, function(x) !is.nan(x)  & !is.infinite(x))),]
Table 6: DuPont Calculations
Ticker Date ROE ROS Turnover Leverage
UN 2018 0.8113550 0.1841630 0.8574744 5.137919
UN 2017 0.4441265 0.1126873 0.8910177 4.423289
UN 2016 0.3169867 0.0983439 0.9341473 3.450471
UN 2015 0.3179610 0.0921497 1.0186240 3.387396
IBM 2018 0.5196475 0.1096606 0.6450779 7.345916
IBM 2017 0.3269865 0.0726949 0.6313140 7.124929
IBM 2016 0.6506632 0.1485504 0.6803354 6.438123
IBM 2015 0.9248352 0.1613633 0.7397710 7.747511
GE 2018 -0.7217111 -0.1838178 0.3934118 9.979952
GE 2017 -0.1514351 -0.0717505 0.3202291 6.590836
GE 2016 0.0989159 0.0627783 0.3271456 4.816320
GE 2015 -0.0623397 -0.0528860 0.2349236 5.017615
F 2018 0.1023322 0.0229328 0.6250019 7.139597
F 2017 0.2172972 0.0493124 0.6064929 7.265614
F 2016 0.1573192 0.0302306 0.6379465 8.157388
F 2015 0.2574192 0.0492986 0.6649239 7.852978

Compute the Need for Funds and Working Capital calculations

########## Create the NFO & WC Calculations #############

#NFO-WC Analysis
NFO_WCAnalysis <- data.frame(matrix("", nrow = nrow(ISBSCF)))
NFO_WCAnalysis[,1] <- NULL
NFO_WCAnalysis$Ticker <- ISBSCF$symbol
NFO_WCAnalysis$Date <- ISBSCF$year
#NFO_WC Analysis Calculations
NFO_WCAnalysis$REC <- ISBSCF$Net.Receivables
NFO_WCAnalysis$INV <- ISBSCF$Inventory
NFO_WCAnalysis$OtherCurrentAssetsNotCash <- ISBSCF$Other.Current.Assets
NFO_WCAnalysis$Payables <- ISBSCF$Accounts.Payable
NFO_WCAnalysis$SpontaneousFunsIncDeftaxes <- ISBSCF$Total.Current.Liabilities + ISBSCF$Other.Current.Liabilities + ISBSCF$Income.Tax.Expense

####
NFO_WCAnalysis$NFO <- NFO_WCAnalysis$REC + NFO_WCAnalysis$INV + NFO_WCAnalysis$OtherCurrentAssetsNotCash - NFO_WCAnalysis$Payables - NFO_WCAnalysis$SpontaneousFunsIncDeftaxes
NFO_WCAnalysis$LTD <- ISBSCF$Long.Term.Debt
NFO_WCAnalysis$EQ <- ISBSCF$Total.stockholders..equity
NFO_WCAnalysis$OtherLongTermLiabilities <- ISBSCF$Minority.Interest + ISBSCF$Other.Liabilities
NFO_WCAnalysis$FA <- ISBSCF$Total.Assets - ISBSCF$Total.Current.Assets

###
NFO_WCAnalysis$WC <- NFO_WCAnalysis$LTD + NFO_WCAnalysis$EQ + NFO_WCAnalysis$OtherLongTermLiabilities - NFO_WCAnalysis$FA
NFO_WCAnalysis$CreditPlusCashMinus <- NFO_WCAnalysis$NFO - NFO_WCAnalysis$WC

NFO_WCAnalysis <- NFO_WCAnalysis[Reduce(`&`, lapply(NFO_WCAnalysis, function(x) !is.nan(x)  & !is.infinite(x))),]

Lets inspect the result.

Table 7: NFO WC Analysis
Ticker Date REC INV OtherCurrentAssetsNotCash Payables SpontaneousFunsIncDeftaxes NFO LTD EQ OtherLongTermLiabilities FA WC CreditPlusCashMinus
UN 2018 4822000 4301000 1387000 9121000 25541000 -24152000 21535000 11572000 6462000 43975000 -4406000 -19746000
UN 2017 4204000 3962000 4356000 8217000 27631000 -23326000 16342000 13629000 7017000 43302000 -6314000 -17012000
UN 2016 3854000 4278000 1120000 8591000 24870000 -24209000 11011000 16354000 8374000 42545000 -6806000 -17403000
UN 2015 3416000 4335000 1352000 8296000 24739000 -23932000 9696000 15439000 6986000 39612000 -7491000 -16441000
IBM 2018 8596000 1682000 2902000 6558000 55526000 -48904000 35681000 16796000 32678000 74236000 10919000 -59823000
IBM 2017 10380000 1583000 2266000 6451000 59456000 -51678000 39871000 17594000 30528000 75621000 12372000 -64050000
IBM 2016 10239000 1553000 532000 6209000 51417000 -45302000 34663000 18246000 28286000 73581000 7614000 -52916000
IBM 2015 9534000 1551000 293000 6028000 51131000 -45781000 33431000 14262000 28533000 67991000 8235000 -54016000
GE 2018 19874000 19271000 7441000 17153000 70230000 -40797000 95234000 30975000 95765000 213155000 8819000 -49616000
GE 2017 24209000 19419000 6720000 15172000 76963000 -41787000 108575000 56024000 105102000 252992000 16709000 -58496000
GE 2016 24076000 22354000 3885000 14435000 90003000 -54123000 105080000 75822000 87728000 233747000 34883000 -89006000
GE 2015 43013000 22515000 5109000 13680000 172208000 -115251000 144659000 98268000 84011000 212175000 114763000 -230014000
F 2018 3698000 11220000 2567000 20426000 115087000 -118028000 11833000 35932000 23222000 141891000 -70904000 -47124000
F 2017 10599000 11176000 3649000 23282000 111404000 -109262000 13174000 35578000 25652000 141695000 -67291000 -41971000
F 2016 11102000 8898000 3145000 21296000 108742000 -106893000 13222000 29170000 25199000 129490000 -61899000 -44994000
F 2015 11042000 8319000 2704000 20272000 101301000 -99508000 11060000 28642000 24068000 122338000 -58568000 -40940000

According to Miguel Antón:

*If NFO > WC - ask for credit

*If NFO < WC - surplus cash

Lets plot the results and analyse them further:

########## Plot the NFO & WC #############

symbol <- NULL
symbols <- unique(NFO_WCAnalysis$Ticker)

# Create the plots for NFO and WC for all symbols
plotList <- list()
for(symbol in symbols){
  plotList[[symbol]] <- ggplot(subset(NFO_WCAnalysis, Ticker %in% symbol)) +
    geom_line(aes(Date, NFO, group = Ticker, colour = "Blue")) +
    geom_line(aes(Date, WC, group = Ticker, colour = "Red")) +
    labs(title=paste0("NFO and WC plot ", symbol), x="Year", y="NFO / WC") +
    scale_color_manual(labels = c("NFO", "WC"), values = c("Blue", "Red")) +
    guides(color=guide_legend("Legend")) +
    theme_tq() +
    theme(legend.position = "right")
}


# Change the symbols to view the NFO WC plots
plotList[1]
## $UN

plotList[2]
## $IBM

plotList[3]
## $GE

plotList[4]
## $F

# Print the results to a PDF document
#pdf("PlotsNFO_WC.pdf", onefile = TRUE, paper = "USr") #Uncomment this if you want to save to .pdf
#plotList
#dev.off()

Plotting the collection period, inventory days and days of payabales

We can also analyse the collection periods for each firm. mm here simply means melted data - which is a way of reshaping a data frame in R, check out the melt functon from the reshape2 package in R if interested.

########## Collection Period, Days of Inventory and Days of Payable #############
# Create the plots for Collection Period, Days of Inventory and Days of Payable

mm <- melt(CashCycle, id = c('Ticker', 'Date'))
mm <- mm[mm$variable == "CollectionPeriod" | mm$variable == "DaysofInventory" | mm$variable == "DaysofPayable",]
mm$value <- with(mm, ifelse(variable == "DaysofPayable", -value, value))
Table 8: Collection Period - Days of Inventory - Days of Payable
Ticker Date variable value
UN 2018 CollectionPeriod 34.52258
UN 2017 CollectionPeriod 28.56669
UN 2016 CollectionPeriod 26.68621
UN 2015 CollectionPeriod 23.40517
IBM 2018 CollectionPeriod 39.42079
IBM 2017 CollectionPeriod 47.87399

Plot the results

########## Plot the Collection Period, Days of Inventory and Days of Payable #############

symbol <- NULL
symbols <- unique(mm$Ticker)

plotListBar <- list()
for(symbol in symbols){
  plotListBar[[symbol]] <- ggplot(mm[mm$Ticker == symbol,], aes(Date, value,  fill = variable)) + facet_wrap(~ Ticker) +
    geom_bar(stat="identity", position = "dodge") +
    theme_tq() +
    theme(legend.position = "right")
}

plotListBar[1]
## $UN

plotListBar[2]
## $IBM

plotListBar[3]
## $GE

plotListBar[4]
## $F

# Print the results to a PDF document
#pdf("Plots_OperationalRatios.pdf", onefile = TRUE, paper = "USr") #Uncomment if you want to save to .pdf
#plotListBar
#dev.off()

Any errors are my own!

You can save the results using:

# library(openxlsx)
# if(devtools::find_rtools()) Sys.setenv(R_ZIPCMD= file.path(devtools:::get_rtools_path(),"zip"))
# write.xlsx(CashCycle, 'CashCycle.xlsx')
# write.xlsx(DuPontAnalysis, 'DuPontAnalysis.xlsx')
# write.xlsx(NFO_WCAnalysis, 'NFO_WCAnalysis.xlsx')
# write.xlsx(df, 'FinancialsAllCompanies.xlsx')
Avatar
Matthew Smith
Researcher in Dept Finance

I am a researcher with a focus on Machine Learning methods applied to economics and finance.

Related

comments powered by Disqus