What formula can I use to search a value and add cells two rows over across multiple sheets? - excel-formula

I am trying to add values across sheets and an having a hard time finding a good formula to do this with.
I have over 300 sheets, representing rooms, that have two relevant columns, one that has dates and another with water consumption usage that look like this:
enter image description here
Issue is, the dates are inconsistent across all of the sheets. The full range of dates should be from 1/13/2023 to 2/6/2023 but many sheets are missing dates because water consumption wasn't read that date.
I have a summary page with a column representing the full range of dates and another column where I want to add usage for the specific date across all the sheets to show how much water was consumed that day across all rooms. Since the dates and usage are all in different cells, I can't call out specific cells. What is the best formula to use and how can I format it correctly?
I tried SUMIF formula's as well as IF formulas and tried nesting variations of them, but ultimately I am having trouble finding a formula/formatting that allows me to call out a cell value (ex, 2/6/2023) and sum the value two columns over. I am fairly new to the more advanced formula's so please forgive my ignorance.

Related

Return a SUM from multiple sheets

I have a formula that returns values from multiple sheets under certain criteria and provides the sum.
=SUMPRODUCT(IFERROR(SUMIF(INDIRECT("'"&B17&" "&Year&"*'!C:C"),"Total",INDIRECT("'"&B17&" "&Year&"*'!Z:Z")),0))
I am looking to return a value that is correlated to Total, but since there are multiple Totals on each page I get back the sum of them all. I only need one Total (that is listed as 100%) from each sheet rather than all of them.
Linking spreadsheets is inherently fragile.
If you do it, then to minimise fragility:
use named ranges for your target cells.
bring them to your consolidating spreadsheet as single numbers - then sum them there.
=SUMPRODUCT(IFERROR(SUMIFS(INDIRECT("'"&B17&" "&Year&"*'!Z:Z"),INDIRECT("'"&B17&" "&Year&"*'!C:C"),B19,INDIRECT("'"&B17&" "&Year&"*'!AA:AA"),"100%")/COUNTIFS(INDIRECT("'"&B17&" "&Year&"*'!C:C"),B19,INDIRECT("'"&B17&" "&Year&"*'!AA:AA"),"100%"),0))
This is the solution I came up with. Changed to SUMIFS to make criteria more detailed searching for "Total" (which is B19) and "100%". Then divide by COUNTIFS using the same criteria as SUMIFS since each sheet has different amount of Total rows

Excel formula to say if a date range is available/unavailable from a list of date ranges?

I'm creating a booking system in Excel and need a formula to tell me if a given date range is available/unavailable from a list of date ranges (bookings).
There's an excellent article on Chandoo.org here about testing to see if two ranges of dates overlap. However the formula provided only works when comparing one set of date ranges to another single set of date ranges. Whereas I require this to work/search through a multitude of date ranges.
=IF(OR(y<a,b<x),"Do not overlap","Overlap")
Take the bookings below for example:
*Bookings*
Start Date End Date
25/01/2019 26/01/2019
29/01/2019 31/01/2019
01/02/2019 03/02/2019
Based on the above, the following dates are available:
21/01/2019 24/01/2019
27/01/2019 28/01/2019
If I fed the formula either of these two sets of dates, I would expect the outcome to read "Available".
Subsequently, the following dates are unavailable:
23/01/2019 26/01/2019
30/01/2019 02/02/2019
...and the formula should read "Unavailable".
As far as I'm aware, the logic around the formula from Chandoo.org does not work when converted to an array of search/compare criteria.
I thought I came close by using an array within two separate =COUNTIF() statements for each comparison y<a or b<x, however the outcomes weren't always correct.
The fact that a simple formula exists comparing two individual sets of date ranges makes me a believe a more complicated formula is derivable which compares a single date range to an array of date ranges.
Any help or guidance is much appreciated.
Thanks,
Mr J.
I hope this solution will help:
Assuming your actual Bookings are present in columns A&B (I copied your dates into cells A3:B5), and your four potential bookings are in columns D&E (cells D1:E4), you can paste the following formula for the first row:
=IF(COUNTIFS($A$3:$A$5,"<="&E1,$B$3:$B$5,">="&E1)+COUNTIFS($A$3:$A$5,"<="&D1,$B$3:$B$5,">="&D1),"Overlap","Do not overlap")
Drag & copy it to the remaining 3 rows. You should see "Do not overlap" for the first two dates and "Overlap" for the remaining two bookings. Let me know if this is what you were looking for.

SUMIF formula based on non-contiguous ranges

I have to populate a cash-flow forecast, dependent on dates between the programme and a spend profile matching. Usually I would do this with SUMIF, using two rows for each element of the cost estimate (stacking the '1st' date of the month above the cost). However, I need to perform all of the calculations for this project in the same row. Is it possible?
I have tried to liberate solutions to similar queries (using SUMPRODUCT, OFFSET, INDEX etc), but I am never able to get the correct result. This may be due my lack of ability to doctor them, rather than these functions failing to provide the solution I need.
Ideally, I would like to formulate the following. "IF the date in every 5th column in the Spend Profile range matches the date in row 2 of the Programme range, SUM the value(s) in the cell(s) 2 columns prior".
The image below shows a very scaled down version of the data I have to work with. I have manually entered the expected results in the Programme range to illustrate the desired result. nb. CELLS G4 and L4 match S2, therefore E4 and J4 are returned.
Sample Data: Scaled down
You can make it work with SUMIFS with your sample data by offsetting the ranges like this
=SUMIFS($A4:$O4,$C2:$Q2,"1st",$C4:$Q4,S$2)

Excel - Checking Values of Cells Across Sheet

I have a spreadsheet that provides monthly results for the last year. The layout is 7 columns per month, each column is the same information for each month (count and rate of various things).
I need to trigger a true/false based on both count and rate being above threshold values in any of the twelve months.
I can do this using either nested IFs or just a lot of IF statements, but was wondering if anyone has a better suggestion? I am open to formulas or VBA, whatever would be most robust.
Image of how each month is arranged
It's a little hard to tell from your spreadsheet what the layout is, but I tried to recreate it (See image below). I entered the function =IF(OR(B2>0.04,C2>2),$A$2) into cell A7 and dragged it across the spreadsheet. All the values you're looking for should be under the Month column. To prevent the function from changing its reference to the first column Name, I used absolute referencing, with dollar symbols $A$2. This way you don't have to keep changing it back to the specified column. Hope this helps.

Return a value relative to every instance of a search term

I have a spread sheet populated with dates (Months) and revenue figures. The sheet is structured with numerous tables all containing these month-revenue pairings but they are not all in the same columns.
I need to be able to search the whole range of cells for a given month and then each time the month is found I need to look across for the revenue figure (5 cells to the right) and return the answer.
The answer returned needs to give the total figure for all instances of the search term.
VLookup won't work because there are multiple tables and they are not all lined up.
Any advice would be very gratefully received.
Thanks
You should use a VBA script for that, IMHO this is not possible to do in a formula. Here is a rough outline what you need to do:
Define an array of the month names as they appear in you sheet
Iterate this array and for each month name find all cells containing it (this might help)
Iterate all cells of each month and do your calculation based on this cell (find a cell with a certain offset or whatever)
If you cen provide a more specific description of your problem (preferably with example data/images), maybe we can give you a more specific answer.

Resources