Return max value ONLY when adjacent cell is blank

LowBorn

New Member
Joined
Jan 6, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I want to find the latest date in a given row (latest date will always be the right-most value in the range).

A) if that date is in a "Received" column (Columns I, K, M, O, or Q), I want to populate the corresponding cell in the S column with a date that is 14 days later.

B) if that date is in a "Sent" column (Column J, L, N, P, or R), I want to populate the corresponding cell in the T column with the number of days since it was sent.

C) There would never be an instance where the cells in Column S and T in the same row would both have a value. When one of them has a value in it, I want the other to be blank (as shown).

I have been searching through videos on MAX, IF, COUNTIF, XLOOKUP...etc. functions and cannot seem to write such a formula that solves this problem. But perhaps I am not framing this problem correctly.

Any help would be greatly appreciated.
 

Attachments

  • receivedsent.JPG
    receivedsent.JPG
    58.1 KB · Views: 7

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi and welcome to MrExcel and happy new year 😁

Try this array formula:

Dante Amor
IJKLMNOPQRST
1Rec 1Sent 1Rec 2Sent 2Rec 3Sent 3Rec 4Sent 4Rec 5Sent 5DueDays
220/oct/2205/ene/23 1
308/jun/2217/jun/2221/dic/2204/ene/23 
411/nov/2214/dic/22 23
519/sep/2230/sep/2207/dic/2209/dic/22 28
616/dic/2230/dic/22 
7n/a18/dic/22 19
Hoja3
Cell Formulas
RangeFormula
S2:S7S2=IF(MAX($I2:$R2)=MAX(IF(MOD(COLUMN($I$1:$R$1),2)=1,$I2:$R2)),MAX($I2:$R2)+14,"")
T2:T7T2=IF(MAX($I2:$R2)=MAX(IF(MOD(COLUMN($I$1:$R$1),2)=0,$I2:$R2)),TODAY()-MAX($I2:$R2),"")
Press CTRL+SHIFT+ENTER to enter array formulas.


NOTE XL2BB:
For the future, it would help greatly if you could give us the sample data in a form that we can copy to test with, rather that a picture.
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in
Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
------------------
 
Upvote 0
Solution
@DanteAmor Wow, this works great! I really appreciate it.

I am still practicing how to read Excel functions. It looks like you defined the max for each row in the beginning of this formula in =IF(MAX($I2:$R2)=... then the rest instructs what to do with that given value. I was not familiar with the MOD and COLUMN functions, but now after researching them, they are pretty neat. COLUMN looks at the column number (A=1, B=2, etc.), and MOD asks if it is divisible by 2. Then it uses the 1 or 0 to determine if that cell will be blank (use '1'), or if it will show the returned value (use '0'). Right after that it (as part of the IF function), it directs what that value will be. Since there are two unique desired outputs, we have two functions.

This answered my query, and has given me a lot to think about.
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,746
Members
449,050
Latest member
excelknuckles

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