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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
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,885
Messages
6,175,179
Members
452,615
Latest member
bogeys2birdies

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