Excel 2007 INDEX/MATCH using MIN on multiple IFs - excel-formula

I've searched here and elsewhere for a solution to my problem. I've tried using different versions, including testing subsets, of the formula below, but have had no luck. I hope you can help me. This is for my personal use at home, as I'm now retired.
I'm using Excel 2007 on Win10. In a specified date range (subset of larger spreadsheet covering more dates before and after), I want to find the date the lowest electricity (kwh) usage occurred, but higher than a minimum of 9), but also only that measured for a 24 hour period. In this formula:
{=INDEX(A3934:A4966,MATCH(MIN(IF(C3934:C4966>9,IF(E3934:E4966=24,C3934:C4966))),C3934:C4966,0))}
Column A is Date, C is usage, E is time (expressed as a number, e.g., 22.75, 24.00, etc.)
Note: I'm not using named ranges
Excel finds a date of correct minimum usage, but the date has a time of less than 24 hours! (there are several dates with the same minimum usage, but only a couple for a 24 hour time period. It seems to work on a 20-day range of data, but if I expand it to the above range, it doesn't. Can you please tell me what is wrong with my formula (or approach)? I've tried reversing the usage and time criteria, but it made no difference (I didn't expect it to). Thanks very much.

I think it is solved....
{=INDEX(A3934:A4966,MATCH(MIN(VALUE(REPLACE(C3934:C4966,1,20,MIN(IF(E3934:E4966=24,1,99)*IF(C3934:C4966>9,C3934:C4966,99))))),C3934:C4966,0))}
I used 99 to have a higher number and exclude it from MIN function.

Related

Calculate minutes in specific period

I have a spreadsheet which has employee working times, listed as Sat-In and Sat-Out for a specific date. The employee shift spans several ours and each "In-Out" period is recorded as a separate line which means the time between the Sat-Out and the next Sat-In means the employee is on a break. I also calculate the time, in minutes of each "sitting" period.
What I can't seem to figure out is how to add a formula which takes the data and further refines it in this manner:
1. I have a core period of 1030-1530, as an example, which is the busy time and requires the maximum employee coverage. The shifts of employees generally spans this core, but in some cases their shift may start or end in the core.
2. I want to calculate how many minutes the employee worked within the core only. I can obviously do this manually using the data, but a formula would be preferred, if possible.
3. As an example, if a person sat-in at 1445 and sat-out at 1545, the core time calculation would be 45 minutes (1445-1530).
I've attached a snapshot of the data to help my explanation.
FYI - the information is pulled from a database as JSON data and converted to excel. I'm not very familiar with JavaScript, but if someone knows a way to do it programatically, I'm willing to give it a try and learn.
Thanks!
![excel]: https://photos.app.goo.gl/dRSTE72CXNa18RzP8
In below example I've used: =MAX(0,MIN($O$2,H2)-MAX($O$1,G2)), and formatted like [mm].
In Excel, units are days, so if you want to calculate the amount of minutes between two timestamps, you need to subtract both and multiply the differencee by 24*60 (being the amount of minutes in one day).
E.g. You start working at 09:07 (cell B2), and finish at 18:07 (cell B3), having a 45-minutes break. Then the time you worked in minutes, is:
=(B3-B2)*24*60-45
Make sure the cell formatting is correct (general), you'll get : 495.

Multiplying different number formats in Excel

I'm using an excel document to track my hours at work (this is my 3rd question about it)
I'm trying to figure out how to multiply a time (i.e. 62:05, which is how long I have worked for over 2 weeks), by my hourly rate (11$/hr) and get approximate gross earnings in this format: $667.43
my time format is [hh]:mm and the 11/hr format doesn't do anything other than the total being 29.0000382 something.
Consider this formula:
=A1*24*B1

Countif a number have days have passed since date

I need to create an analysis for work in Excel, one of the things that have been asked is that I include a chart, this chart needs to show data grouped by a state given to it and a number of days passed since the date it was created.
I need to count how many of these bits of data there are that are older than 1 day, older than 2 days and so on, I have been looking at some way to combine COUNTIF/COUNTIFS and TODAY()-Date named in cell, this hasn't been fruitful, I am aware that I would just do the TODAY() bit in some seperate cells and work with the data from the but I would prefer a way to do it all in one, if there is some way to do such a thing in one formula it would be great, if not I'll just have to tell my boss no can do.
Thanks in advance for any help given, even if it is telling me it's not possible.
=CountIfs(state, inputState, date, "<"&Today()-1, date, ">="&Today()-2)
That will give you all items holding state from the day before yesterday.
state and date are from your data. Replace with column references or (better) named range names.
Use < and >=, or <= and >, when slicing data by date (or any numeric amount). Using < and > or <= and >= forces you to think hard about gaps or overlap and that's no fun.
Another method would be to use SUMPRODUCT to count the number of occurrences:
=SUMPRODUCT(--(A1:A20>=TODAY()-2))
The number 2 can be increased or decreased to vary the length of time from TODAY(). The >= symbols can also be changed based on whether you would like to count the number of dates before or after TODAY()-2.

Joining a date and time into a single cell in Excel / VBA

I have to report basically the same information from inspections to two different clients, both of whom have provided me with an Excel spreadsheet in their own preferred format, and password protected. I have put the two sheets into my own workbook, and have managed to get 'almost' all the data on both sheets to populate from my own data. Where I am stuck though is on the time logs.
Client 'A' has each time and date in a single column, in the format "12.29.12 14:30". Client 'B' has two columns, date as "12/29/12" in the first, and time as "1430" in the second.
I'm trying to avoid having to type all the same dates and times twice - it can be several dozen lines - both to save effort and to avoid errors. What I really need to do is either concatenate the date and time from client 'B's report and put it into client 'A's, or split the date and time up in 'A's so I can put it ito 'B's. I've tried several approaches, but just end up with error codes or meaningless numbers.
Can anyone point me in the right direction?
Thanks,
Richard
Never mind... the very next thing I tried worked :-)
To anyone else reading this, the trick is not to concatentate the date and time values, but to add them together.
Richard
As you later pointed out in your own question, in order to manipulate date/times in Excel, you should add instead of concatenating.
The reason for this is that Excel stores all date/times as a number representing the number of days since January 1, 1900*. This number is stored as a 8-byte double.
Use Excel number formats to display the date/time format that you desire.
If you find in a worksheet that some cell's dates are in fact stored as text, use the DATEVALUE function.
*By default, Excel 2010 for Windows uses the number of days since 1900. There is an option to use the number of days since 1904 for compatibility with other versions.

MS-Excel Negative times

I'm writing a spreadsheet for a shop manager. What it does is keep track of the number of hours a worker has worked.
So you enter times for Monday-Sunday, and then an adjustment - e.g. if they work 40/40/40/32 hours for the month, then you would have an adjustment of -2/-2/-2/+6 to bring the worker to the 38 hour week that he's being paid for. Some (most) weeks may be adjusted for overtime. The spreadsheet then totals the hours.
This spreadsheet is supposed to just be a self-calculating version of a paper form.
It needs to match the paper form as it has to be substituted for the old form which is given to some other member of the company (pay clerk, I don't know; I'm not rebuilding their whole system, just replacing a form)
I'm having trouble entering a negative time in the adj field - the field has a [h]:mm formatting. and when i enter a negative time (e.g. -2:00) it displays an error, saying "incorrectly formatted equation", with the suggestion that if I was entering a string then I should prefix with a apostrophe.
How do I overcome this?
Tools - Options - Calculation - 1904 date system
Check this box to use the 1904 (Mac) date system and you will be able to use negative dates and times. I'm not sure how this will effect existing spreadsheets, so maybe someone else can speak to that.
According to Excel...
"Dates and Times that are negative appear as ########"
Doesn't sound like you're going to be able to do that with an auto-summation formula. You'll have to set the formatting as none and just type it in (which defeats the purpose).
I am solving the same problem. Setting for date formatting "1904" is necessary for both below described solution.
You can enter an equation as a result of predeceasing cells like C5-C4-C3 (check out-check in-standard working time). The result is negative and it will be displayed like -1:15 and you can further process it.
Second way was already described above - to put into the requested cell a negative decimal value as a fraction of "1". "1,000"=24 hours, "0,5"=12 hours, "0,01"= 14 minutes, "0,041667"=1 hour. You have to find the correct decimal numbers first.

Resources