Struggling to understand function

GreenCat223

New Member
Joined
Mar 27, 2024
Messages
8
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
Hi there, I came across this function which calculates how many days occur between two dates:

=SUM(N(WEEKDAY(ROW(INDIRECT(A1&":"&A2)))=4))

I'm trying to dissect this formula to understand it better but the part I'm struggling with is the "INDIRECT(A1&":"&A2)" function. I'm not sure what job this performs in the function to help it arrive at the final result.

Please can someone explain this to me?!

Thank you!
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
That formula does not calculate the number of days, but the number of Wednesdays between two dates & can be replaced by
Excel Formula:
=NETWORKDAYS.INTL(A1,A2,"1101111")
 
Upvote 1
Thank you for the above formula but it still doesn't answer my question. I was keen to learn and understand this "INDIRECT(A1&":"&A2)" syntax.
 
Upvote 0
In Excel dates are just numbers so 1st June 25 is 45444 & today is 45450 The indirect concatenates them together with the : & the row function will see that as row numbers & return ann array of all those rows.
 
Upvote 1
Solution
INDIRECT returns the reference specified by a text string. In this case there is a ":" so A1 and A2 would contain cell references and INDIRECT would return a range.
e.g. if A1="C4" and A2="F9" then the range returned would be C4:F9.
 
Upvote 1
Thank you for the above formula but it still doesn't answer my question. I was keen to learn and understand this "INDIRECT(A1&":"&A2)" syntax.
In newer versions of Excel (Excel 2021, Excel 365 and newer), "ROW(INDIRECT(A1&":"&A2))" would be replaced with

"SEQUENCE(A2-A1+1,,A1)".
 
Upvote 1

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

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