How to get formulas to pull through info from other sheets?

Slyon

New Member
Joined
Jul 26, 2021
Messages
16
Office Version
  1. 2016
Platform
  1. Windows
Please could someone hopefully advise on the below..

I am wanting to use my first sheet of my workbook as the main part of my spreadsheet, to show the outcome of my formulas from the data provided on several other sheets.

How do I go about this? I'm assuming there will be something I need to add onto the formula to get it to relate to the relevant sheet.. :unsure:

If it helps, this will be the formula I'll be using on each row changing the relevant columns etc - =IF(F3<EDATE(TODAY(),-12),0,F3-MAX(E3,EDATE(TODAY(),-12))+1)+IF(H3<EDATE(TODAY(),-12),0,H3-MAX(G3,EDATE(TODAY(),-12))+1)+IF(J3<EDATE(TODAY(),-12),0,J3-MAX(I3,EDATE(TODAY(),-12))+1) Therefore I just need to get this to relate to other sheets depending on which one it relate to.

Much appreciated, as always! :)
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi Slyon,

To address another sheet you prefix the cell address by the sheet name, wrapped in single quotes in case it contains a space, and then an exclamation mark:
Excel Formula:
=IF('My First Sheet'!F3<EDATE(TODAY(),-12),0,'My First Sheet'!F3-MAX('My First Sheet'!E3,EDATE(TODAY(),-12))+1)+IF('My First Sheet'!H3<EDATE(TODAY(),-12),0,'My First Sheet'!H3-MAX('My First Sheet'!G3,EDATE(TODAY(),-12))+1)+IF('My First Sheet'!J3<EDATE(TODAY(),-12),0,'My First Sheet'!J3-MAX('My First Sheet'!I3,EDATE(TODAY(),-12))+1)
 
Upvote 0
Hi Slyon,

To address another sheet you prefix the cell address by the sheet name, wrapped in single quotes in case it contains a space, and then an exclamation mark:
Excel Formula:
=IF('My First Sheet'!F3<EDATE(TODAY(),-12),0,'My First Sheet'!F3-MAX('My First Sheet'!E3,EDATE(TODAY(),-12))+1)+IF('My First Sheet'!H3<EDATE(TODAY(),-12),0,'My First Sheet'!H3-MAX('My First Sheet'!G3,EDATE(TODAY(),-12))+1)+IF('My First Sheet'!J3<EDATE(TODAY(),-12),0,'My First Sheet'!J3-MAX('My First Sheet'!I3,EDATE(TODAY(),-12))+1)
Thanks Toadstool, that seems to have worked!

Except the only problem I have now though, is that I don't know how to get the formula to include all date ranges within two certain columns from that second sheet, if that makes sense?
 
Upvote 0
To clarify..

The formula is only working for one date range on the other sheet, where as I need all date ranges within two columns totalling together then show as a total on the main front sheet. E.g. B4 & C4 = 1 day then add B5 & C5 which = 1 day etc etc... if that makes sense?

1635343384362.png
 
Upvote 0
You've not actually stated your aim so I'm guessing you're trying to add together absence days over the last 12 months?

Is this what you want?

Slyon.xlsx
ABC
1
2FromTo
319-Sep-2119-Sep-21
420-Sep-2120-Sep-21
521-Sep-2121-Sep-21
622-Sep-2122-Sep-21
723-Sep-2123-Sep-21
824-Sep-2124-Sep-21
925-Sep-2105-Oct-21
1026-Sep-2126-Sep-21
1127-Sep-2127-Sep-21
1228-Sep-2128-Sep-21
1329-Sep-2129-Sep-21
1430-Sep-2130-Sep-21
1501-Oct-2101-Oct-21
1602-Oct-2102-Oct-21
1703-Oct-2103-Oct-21
1804-Oct-2104-Oct-21
19
My First Sheet


Slyon.xlsx
ABC
1Absence Days in Last 12 Months
226
3
Absence
Cell Formulas
RangeFormula
B2B2=SUMPRODUCT(--('My First Sheet'!$B$3:$B$9999>EDATE(TODAY(),-12))*(('My First Sheet'!$C$3:$C$9999+1)-'My First Sheet'!$B$3:$B$9999))
 
Upvote 0
You've not actually stated your aim so I'm guessing you're trying to add together absence days over the last 12 months?

Is this what you want?

Slyon.xlsx
ABC
1
2FromTo
319-Sep-2119-Sep-21
420-Sep-2120-Sep-21
521-Sep-2121-Sep-21
622-Sep-2122-Sep-21
723-Sep-2123-Sep-21
824-Sep-2124-Sep-21
925-Sep-2105-Oct-21
1026-Sep-2126-Sep-21
1127-Sep-2127-Sep-21
1228-Sep-2128-Sep-21
1329-Sep-2129-Sep-21
1430-Sep-2130-Sep-21
1501-Oct-2101-Oct-21
1602-Oct-2102-Oct-21
1703-Oct-2103-Oct-21
1804-Oct-2104-Oct-21
19
My First Sheet


Slyon.xlsx
ABC
1Absence Days in Last 12 Months
226
3
Absence
Cell Formulas
RangeFormula
B2B2=SUMPRODUCT(--('My First Sheet'!$B$3:$B$9999>EDATE(TODAY(),-12))*(('My First Sheet'!$C$3:$C$9999+1)-'My First Sheet'!$B$3:$B$9999))
My apologies, yes that is correct.

I'm hoping to have one sheet as the main sheet then several other sheets with peoples names on. Then under those named sheets will be all that persons absence dates (like the above list of dates photo).

I then need the total of all date ranges entered in those two columns under each sheet sheet to populate onto the main page under the relevant person. The formula also needs to eliminate any days which are from before a year from the current date (As per my previous post on here - Formula needed .

See example below of what my spreadsheet looks like:

1635504237780.png
 
Upvote 0
Ah! Therein lies more complexity.

Unless you want to handcraft each formula cell to include the sheet name then you'll need to use INDIRECT.

Let me check something, are you sure it's a rolling 12 month period and not a defined date range for the reporting period? (e.g. instead of dates after 29-Oct-2020 do you use a 1-Jan-2021 to 31-Dec-2021 as the period?)

I've shown the use of INDIRECT below (omitting "Name 3" to test error handling) but you can see the issue in Name 2 dates 26-Oct-2020 to 05-Nov-2020. Because 26-Oct-20 is more than a year ago then it does not include that range, but 30-Oct-2020 to 05-Nov-2020 are within the range and I can't see how to address that without a redesign (maybe having a calculation on each Name sheet in a specific cell and just retrieving that number for the report).

Slyon2.xlsx
ABCD
1
2FromTo
319-Sep-2119-Sep-21
420-Sep-2120-Sep-21
521-Sep-2121-Sep-21
622-Sep-2122-Sep-21
723-Sep-2123-Sep-21
824-Sep-2124-Sep-21
925-Sep-2105-Oct-21
1026-Sep-2126-Sep-21
1127-Sep-2127-Sep-21
1228-Sep-2128-Sep-21
1329-Sep-2129-Sep-21
1430-Sep-2130-Sep-21
1501-Oct-2101-Oct-21
1602-Oct-2102-Oct-21
1703-Oct-2103-Oct-21
1804-Oct-2104-Oct-21
19
Name 1


Slyon2.xlsx
ABC
1
2FromTo
319-Sep-2022-Sep-20
426-Oct-2005-Nov-20
528-Nov-2001-Dec-20
631-Dec-2003-Jan-21
702-Feb-2105-Feb-21
807-Mar-2110-Mar-21
909-Apr-2112-Apr-21
1012-May-2115-May-21
11
Name 2


Slyon2.xlsx
ABCD
1EmployeePositionSEDays Taken
2Name 126
3Name 224
4Name 3No such name
Absence Tracker
Cell Formulas
RangeFormula
D2:D4D2=IFERROR(SUMPRODUCT(--(INDIRECT("'"&A2&"'!$B$3:$B$9999")>EDATE(TODAY(),-12))*((INDIRECT("'"&A2&"'!$c$3:$c$9999")+1)-INDIRECT("'"&A2&"'!$B$3:$B$9999"))),"No such name")
 
Upvote 0
Ah! Therein lies more complexity.

Unless you want to handcraft each formula cell to include the sheet name then you'll need to use INDIRECT.

Let me check something, are you sure it's a rolling 12 month period and not a defined date range for the reporting period? (e.g. instead of dates after 29-Oct-2020 do you use a 1-Jan-2021 to 31-Dec-2021 as the period?)

I've shown the use of INDIRECT below (omitting "Name 3" to test error handling) but you can see the issue in Name 2 dates 26-Oct-2020 to 05-Nov-2020. Because 26-Oct-20 is more than a year ago then it does not include that range, but 30-Oct-2020 to 05-Nov-2020 are within the range and I can't see how to address that without a redesign (maybe having a calculation on each Name sheet in a specific cell and just retrieving that number for the report).

Slyon2.xlsx
ABCD
1
2FromTo
319-Sep-2119-Sep-21
420-Sep-2120-Sep-21
521-Sep-2121-Sep-21
622-Sep-2122-Sep-21
723-Sep-2123-Sep-21
824-Sep-2124-Sep-21
925-Sep-2105-Oct-21
1026-Sep-2126-Sep-21
1127-Sep-2127-Sep-21
1228-Sep-2128-Sep-21
1329-Sep-2129-Sep-21
1430-Sep-2130-Sep-21
1501-Oct-2101-Oct-21
1602-Oct-2102-Oct-21
1703-Oct-2103-Oct-21
1804-Oct-2104-Oct-21
19
Name 1


Slyon2.xlsx
ABC
1
2FromTo
319-Sep-2022-Sep-20
426-Oct-2005-Nov-20
528-Nov-2001-Dec-20
631-Dec-2003-Jan-21
702-Feb-2105-Feb-21
807-Mar-2110-Mar-21
909-Apr-2112-Apr-21
1012-May-2115-May-21
11
Name 2


Slyon2.xlsx
ABCD
1EmployeePositionSEDays Taken
2Name 126
3Name 224
4Name 3No such name
Absence Tracker
Cell Formulas
RangeFormula
D2:D4D2=IFERROR(SUMPRODUCT(--(INDIRECT("'"&A2&"'!$B$3:$B$9999")>EDATE(TODAY(),-12))*((INDIRECT("'"&A2&"'!$c$3:$c$9999")+1)-INDIRECT("'"&A2&"'!$B$3:$B$9999"))),"No such name")
Unfortunately it would need to be on a rolling basis in the circumstances this is needed for, otherwise it would probably be alot easier sadly. :(

I don't mind changing the formulas where it states the sheet names in them for each one if needed..

The spreadsheet needs to be used by other people at a glance, so needs to always be up to date for them, if you get what I mean?
 
Upvote 0
I would redesign the name sheets to include the calculation then just pull the total into the Absence Tracker sheet, like this:

Slyon3.xlsx
ABCDEF
1
2FromToLast 12 MonthsTotal
319-Sep-2019-Sep-2008
431-Oct-2001-Nov-201
501-Jan-2105-Jan-215
622-Sep-2122-Sep-211
724-Sep-2124-Sep-211
811-Nov-2102-Nov-220
9 
Name 1
Cell Formulas
RangeFormula
F3F3=SUM($E$3:$E$999)
E3:E9E3=IF(OR(B3="",C3=""),"",MAX(MIN(C3,TODAY())-MAX(B3,EDATE(TODAY(),-12))+1,0))


Slyon3.xlsx
ABCDEF
1
2FromToLast 12 MonthsTotal
319-Sep-2022-Sep-20029
426-Oct-2005-Nov-205
528-Nov-2001-Dec-204
631-Dec-2003-Jan-214
702-Feb-2105-Feb-214
807-Mar-2110-Mar-214
909-Apr-2112-Apr-214
1012-May-2115-May-214
11 
Name 2
Cell Formulas
RangeFormula
F3F3=SUM($E$3:$E$999)
E3:E11E3=IF(OR(B3="",C3=""),"",MAX(MIN(C3,TODAY())-MAX(B3,EDATE(TODAY(),-12))+1,0))


Slyon3.xlsx
ABCD
1EmployeePositionSEDays Taken
2Name 18
3Name 229
4Name 3No such name
5 
Absence Tracker
Cell Formulas
RangeFormula
D2:D5D2=IF(A2="","",IFERROR(INDIRECT("'"&A2&"'!$F$3"),"No such name"))
 
Upvote 0

Forum statistics

Threads
1,214,824
Messages
6,121,784
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top