Getting formula to calculate conditionally based on number of account occurrences

eagerexceler

New Member
Joined
Jan 10, 2017
Messages
28
Office Version
  1. 2016
Platform
  1. Windows
Hi y'all,

I have a formula in column AV of my spreadsheet that mostly does what I want by conditionally comparing dates in other columns and populating the value from column S accordingly. Column AV is populating if a date comparison is true.

The condition that I'm trying to add to this formula is that I only want it to populate the value in column S for the first occurrence of a true date comparison from columns W through AC. So from the table example, I want AV5 to populate with the value from S5 since the date comparison is true, but I don't want AV6 to populate. The same is true for AV7 and AV8, and AV11 and AV12.

BCBS Readmissions and Pre Admission Testing By MRN - Combined - BSLMC.xlsx
ABDEFGHSWXYZAAABACAV
3123456730
4Common #Common # - #AcctCommon #BeginEndI/PExpI 1I 2I 3I 4I 5I 6I 7Acct W/In 30 Days?
5609609-18456091/2/191/6/19I6922.211/2/20191/23/20194/29/20195/23/20199/30/20197/26/20208/26/20206922.21
6609609-28466091/23/192/1/19I6922.211/2/20191/23/20194/29/20195/23/20199/30/20197/26/20208/26/20206922.21
7609609-38476094/29/195/5/19I9691.381/2/20191/23/20194/29/20195/23/20199/30/20197/26/20208/26/20209691.38
8609609-48486095/23/195/26/19I9691.381/2/20191/23/20194/29/20195/23/20199/30/20197/26/20208/26/20209691.38
9609609-58496099/30/1910/7/19I9691.381/2/20191/23/20194/29/20195/23/20199/30/20197/26/20208/26/20209691.38
10609P85060910/9/2010/9/20P256000000000.00
11609609-68516097/26/207/31/20I9981.821/2/20191/23/20194/29/20195/23/20199/30/20197/26/20208/26/20209981.82
12609609-78526098/26/209/3/20I11728.641/2/20191/23/20194/29/20195/23/20199/30/20197/26/20208/26/202011728.64
Sheet1
Cell Formulas
RangeFormula
X3:AC3X3=W3+1
A5:A12A5=E5
B5:B12B5=IF($H5="I",$E5&"-"&COUNTIFS($E$5:$E5,$E5,$H$5:$H5,"I"),"P")
W5:W12W5=IFNA(IF($H5="I",VLOOKUP($A5&"-"&W$3,$B:$F,5,FALSE),"0"),0)
X5:AC12X5=IFNA(IF($H5="I",VLOOKUP($A5&"-"&X$3,$B:$F,5,FALSE),"0"),"0")
AV5:AV12AV5=IF(AND($H5="I",((OR(($W5+AV$3>=$X5),$X5+AV$3>=$Y5,$Y5+AV$3>=$Z5,$Z5+AV$3>=$AA5,$AA5+AV$3>=$AB5,$AB5+AV$3>=$AC5,)))),$S5, 0)


Hope this makes sense. Any ideas are greatly appreciated.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,141,707
Messages
5,707,983
Members
421,539
Latest member
zuniBM

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