Formula to contain contents of another cell

ThunderPlane

New Member
Joined
Apr 7, 2021
Messages
13
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile
  3. Web
I need to create a MAX (with IF) formula similar to this:

=MAX(IF(C3:C12=A3,G3:G12))

But I want to keep the cell ranges dynamic and taken from another cell.

For example, cell B3 has the value "C7:C10" (this is in turn achieved by a VLOOKUP formula, and is not a text value)

Now, in the above formula I want "C3:C12" to be replaced with the contents I have in cell B3, i.e. "C7:C10", something like this:

=MAX(IF(Contents in B3=A3,G3:G100))

So finally my formula should be:

=MAX(IF(C7:C10=A3,G3:G12))

Please help me out with this. Thank you in advance for you help.

Regards,

TP.

PS: Below is a sample of the worksheet I am creating

ReferenceRangeNameDateTimeOpenHighLow
BC7:C10A03-01-202009:45:59232323
A03-01-202009:45:59153515401535
A03-01-202009:45:590.10.10.1
B03-01-202011:45:590.80.80.8
B03-01-202011:45:59112211221080.1
B03-01-202013:45:591019.31032.11019.3
B03-01-202009:45:590.90.90.9
C03-01-202010:45:590.90.90.9
C03-01-202011:45:591.11.11.1
C03-01-202013:45:591.31.31.25
 

ThunderPlane

New Member
Joined
Apr 7, 2021
Messages
13
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile
  3. Web
OMG! Sorry for my noob mistake. To add the new data I did an "copy & insert cells" due to which the formula ranges changed automatically, and I forgot to update the formulae accordingly. Sincerely sorry about this 🙏

Your formula works perfectly, thank you very much 😊
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,856
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
As it happens you can just use your original formula. As A338 is the first cell that contains the relevant code, the max/if can't return a value from any row before 338.
 

ThunderPlane

New Member
Joined
Apr 7, 2021
Messages
13
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile
  3. Web
You're welcome & thanks for the feedback.
As it happens you can just use your original formula. As A338 is the first cell that contains the relevant code, the max/if can't return a value from any row before 338.
But we are using the MAX function in Column C , where the value does get repeated.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,856
Office Version
  1. 365
Platform
  1. Windows
Yes but it's only getting the max value from col C IF col A equals AE3
 

ThunderPlane

New Member
Joined
Apr 7, 2021
Messages
13
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile
  3. Web
Yes but it's only getting the max value from col C IF col A equals AE3
True, but what if the MAX value in col C is in a row above the col A value? I understand MAX will take the full column into consideration, and not just from the row where the earlier calculation was done. If this happens then my further calculations will incorrect, as I intend to find the MAX value after the specified date and time mentioned in cols O & P.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,129
Messages
5,640,296
Members
417,135
Latest member
zeusmining

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
Top