Counting the frequency of an event - excel

I have a string of stock price data data and I want to be able to count how many days the price moves up or down lasted. So for example, from the data I have a used "if" functions to determine if a day was up or down: "U" for and Up day and "D" for a Down day. Lets say the string then looks like this:
UUUDDUDUDUDUUU
I want a formula to count that there were 3 Up days, and 2 Down Days, 1 Up, 1 Down etc etc... and then I will be able to built a profile of how long the prices moves in one direction lasted....i want to then display the results in histograms or charts.
Does anyone know what formula or function I can use to get the results I want?
Appreciate any help. thanks

Ok, I created something on Google Spreadsheet that tracks the S&P 500 for this month. You can enter any other stock prices you want.
You probably want something like the spreadsheet.
Look at the formulas for the columns: UP/DOWN, UP Trend, Down Trend
View the spreadsheet HERE.
Download the Excel.

Related

Average using excel formulas

hope it's been a good holiday.
Had a question regarding excel, that can best be phrased through an example.
I have a table which has 4 columns and 2 rows. in the each of the 4 inputs in row 1, we have a $ amount our company has (100000, 150000, 200000, 175000), and in row 2 we have the amount of product which we've been able to purchase, note: this products doesn't have a fixed price, and is constantly changing. Row 2 has the values (10000,20000,22000, 18000 respectively for the above $ amounts).
I want to have a cell, where if I input the dollar amount, I have, it will give me the average amount of product I can buy based on the historical data. Also, I need the formula to be dynamic, i.e once I add a fifth column, it takes the average using 5 datapoints, instead of the previous 4.
Thanks for any help, was having problems uploading an excel to display this, so hope this suffices.
I tried various look up/index formulas with no luck.
You want FORECAST.LINEAR():
=FORECAST.LINEAR(C6,2:2,1:1)

Excel - Photovoltaic - converting hours

I have a problem that I would like to solve. I got data in excel, which are
in this form, basically I have number of hours from 0 to 8760 in a column in excel, which represent the whole year. And in another column I have "Power from PV" which corresponds to how much power does photovoltaic system produce in that specific hour. I would like to convert these hours to months, so I could make a graph of monthly production of power in a whole year. Is there some sensible way to do this in excel?
Thank you for any suggestions.
You need three things:
You need to know that 1 equals 1 day, so if you want to convert hours into date related information, you need to divide it by 24.
There is a function, called Date(), which gives the date, based on year, month and day, like =DATE(2022,1,1).
There is a function, called Month(), which gives the month number of a date.
So, in summary, you need something like:
=MONTH(DATE(2022,1,1) + A3 / 24)
Once you have this in a new helper column, you can start using the Subtotals basic Excel feature.

Excel - Evaluate multiple cells in a row and create report or display showing lowest to highest

In an Excel 2003 spreadsheet, I have the top row of cells calculating the number of days and hours I have worked on something based on data I put in the cells below for each category. For example I enter the time spent on Programming, Spoken languages, house, piano, guitar...etc. The top cell in each category will keep track of and display how many days and hours I spent as I add the time spent for each category each day. I want to evaluate this top row and then list in a "report" (like a pop up box or another tab or something) in order from least amount of time to the most amount of time. This is so I can see at a glance which category is falling behind and what I need to work on. Can this be done in Excel? VBA? Or do I have to write a program from scratch in C# or Java? Thanks!
VH
Unbelievable... I've been scolded for trying to understand an answer and requested to mark this question answered. I don't see anything to do this and could not find anything that tells you how, so I'm just writing it here. MY QUESTION WAS ANSWERED... But thanks anyway...
Consider the following screenshot:
The chart data is built with formulas in columns H3:I3 and below. The formulas are
H3 =INDEX($B$3:$F$3,MATCH(SMALL($B$2:$F$2,ROW(A1)),$B$2:$F$2,0))
I3 =INDEX($B$2:$F$2,MATCH(SMALL($B$2:$F$2,ROW(A1)),$B$2:$F$2,0))
Copy down and build a horizontal bar chart from the data. If you want to change the order of the source data, use LARGE() instead of SMALL().
Alternative Approach
Instead of recording your data in a matrix, consider recording in a flat table with columns for date, category and time spent. That data can then easily be evaluated in many possible ways without using any formulas at all. The screenshot below shows a pivot table and chart where the data is sorted by time spent.
Edit after inspecting file:
Swap rows 2 and 3. Then you can choose one of the approaches outlined above.
Consider entering the study time as time values. It is not immediately clear if your entry 2.23 means 2 hrs and 23 minutes, or 2 hrs plus 0.23 of an hour, which totals to 2hrs, 13 minutes.
If you are using the first method, then all your sums involving decimals are off. For example, the total for column B is 7.73 as you sum it. Is that meant to be 7 hrs and 73 minutes? That would really be 8 hrs and 13 minutes, no? Or is it meant to be 7 hrs and 43 minutes? You can see how this is confusing. Use the colon to separate hrs and minutes and - hey - you can see human readable time values and don't have to convert minute values into decimals.

How Many Times Does a Value Occur in a Month?

I've got data that looks like:
Date |ID Number
9/6/2013 |ABCDE
11/26/2013 |LMNOP
3/25/2014 |VWXYZ
3/27/2014 |VWXYZ
4/8/2014 |VWXYZ
4/10/2014 |VWXYZ
I was wondering if there was a code that would allow me to count up a particular number of times an ID Number was associated with a particular month. My data has been sorted by ID Number, and I need to know how many times the Number occurs per month.
For example, I would need to know that in a column for March that VWXYZ occurred twice, and the same in a column for April. I need to know if there is a formula for automatically searching for the ID Number and counting how many times that Number is associated with a particular month. Everywhere I look, it involves manually entering the ID Number into the formula. I have almost two thousand entries in my data sheet, and I was hoping there was an easier way.
This has stumped me for days, and any help is greatly appreciated.
If Date is in A1, the start date for your chosen month is in D1 and the string to search for in E1 please try:
=COUNTIFS(A:A,">="&D1,A:A,"<="&EOMONTH(D1,0),B:B,E1)
Edit re OP's comment to question
In row2 and copied down to suit:
=COUNTIFS(A:A,">="&EOMONTH(A2,-1)+1,A:A,"<="&EOMONTH(A2,0),B:B,B2)

Excel what method use to calculate time and age

I have got a table with 2 columns:
AGE between 10 and 90 lets say :]
and Time (spent on mobiles)
What I need to do is- count how long people spent time on mobiles between 16 and 40.
First part may be seemingly simple because we can count by countif how may people is using mobiles between 16 and 40 but how evaluate spend time on mobiles by the particular age groups.
I will appreciate aaany help
regards
If you need to analyze your data more than creating a static function to count, you may consider using Pivot tables.
Build a simple pivot table with age in rows and time in values. Once this simple pivot table built, you can filter on the rows values, group them together among specific grouping criteria, select specific values by hand, etc.
I like the idea given by Boud of using Pivots but if you specifically want a formula then you can use SumProduct()
=SUMPRODUCT((A2:A13>16)*(A2:A13<40)*(B2:B13))
Do remember to format the cell as [h]:mm:ss since you are adding up times.
SNAPSHOT
You can for example add additional column, with formula like:
=IF ( AND(A1>16, A1<40), B1, 0 )
where A is column with AGE, and B is column with Time, and then simply sum it!

Resources