Simply formula

Corleone

Well-known Member
Joined
Feb 2, 2003
Messages
841
Office Version
  1. 365
This one is just out of interest
A colleague has sent over a spreadsheet which generates timelines based on dates contained in cols B - F
It used a series of dates at the top in row 2 from col g which are set up in 14 day intervals and then the rows below contain the formula below in order to populate the cells with specific characters depending on the dates in Cols B-F
Im sure there must be a simplified formula which will perform the same output

=IF(IFERROR(OR(I$2-$B6=-13,I$2-$B6=-12,I$2-$B6=-11,I$2-$B6=-10,I$2-$B6=-9,I$2-$B6=-8,I$2-$B6=-7,I$2-$B6=-6,I$2-$B6=-5,I$2-$B6=-4,I$2-$B6=-3,I$2-$B6=-2,I$2-$B6=-1,I$2-$B6=0),""),CHAR(186),IF(IFERROR(OR(I$2-$C6=-13,I$2-$C6=-12,I$2-$C6=-11,I$2-$C6=-10,I$2-$C6=-9,I$2-$C6=-8,I$2-$C6=-7,I$2-$C6=-6,I$2-$C6=-5,I$2-$C6=-4,I$2-$C6=-3,I$2-$C6=-2,I$2-$C6=-1,I$2-$C6=0),""),CHAR(190),IF(IFERROR(OR(I$2-$D6=-13,I$2-$D6=-12,I$2-$D6=-11,I$2-$D6=-10,I$2-$D6=-9,I$2-$D6=-8,I$2-$D6=-7,I$2-$D6=-6,I$2-$D6=-5,I$2-$D6=-4,I$2-$D6=-3,I$2-$D6=-2,I$2-$D6=-1,I$2-$D6=0),""),CHAR(191),IF(IFERROR(OR(I$2-$E6=-13,I$2-$E6=-12,I$2-$E6=-11,I$2-$E6=-10,I$2-$E6=-9,I$2-$E6=-8,I$2-$E6=-7,I$2-$E6=-6,I$2-$E6=-5,I$2-$E6=-4,I$2-$E6=-3,I$2-$E6=-2,I$2-$E6=-1,I$2-$E6=0),""),CHAR(192),IF(IFERROR(OR(I$2-$F6=-13,I$2-$F6=-12,I$2-$F6=-11,I$2-$F6=-10,I$2-$F6=-9,I$2-$F6=-8,I$2-$F6=-7,I$2-$F6=-6,I$2-$F6=-5,I$2-$F6=-4,I$2-$F6=-3,I$2-$F6=-2,I$2-$F6=-1,I$2-$F6=0),""),CHAR(187),"")))))



any ideas?
 

Attachments

  • Untitled.png
    Untitled.png
    28.5 KB · Views: 12

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
One option would be like
Excel Formula:
=IF(MEDIAN(I2,B6,I2+13)=B6,CHAR(186),IF(MEDIAN(I2,C6,I2+13)=C6,CHAR(190)))
 
Upvote 0
Here's another option for G4 copied down and across.

Excel Formula:
=IFNA(CHAR(CHOOSE(MATCH(1,COUNTIFS(G$2,"<="&$B4:$F4,G$2,">"&$B4:$F4-13),0),186,190,191,192,187)),"")
 
Upvote 0
Or another one you could try:

Excel Formula:
=FILTER(CHAR({186,190,191,192,187}),(G$2<=$B4:$F4)*(G$2>$B4:$F4-13),"")
 
Upvote 0
Thanks for all your responses - Much appreciated
Heres another one for you

Is there a way of performing the same result purely based on using the dates in the date header rather than specifying the -13 - for example If this report was to be modified so that in some instances the difference between the dates running from left to right at the top were not always the same (so in stead of a constant -13 it would be displaying the character based on it occurring after $I$2 but before or on the date in $I$3

Cheers
 
Upvote 0
Hi, if the interval is consistent across all of the dates then you could determine the interval based on the difference between the first 2 dates, like this:

=FILTER(CHAR({186,190,191,192,187}),(G$2<=$B4:$F4)*(G$2>$B4:$F4-($H$2-$G$2)),"")

If it's not consistent, then you need to define how to determine what the interval of the date in the last column is.

If might make more sense to have two rows of dates specifying both the start and end date - something like this:
Book1
BCDEFGHIJKLM
2Start05-Sep-202219-Sep-202203-Oct-202217-Oct-202231-Oct-202214-Nov-202228-Nov-2022
3End18-Sep-202202-Oct-202216-Oct-202230-Oct-202213-Nov-202227-Nov-202211-Dec-2022
401-May-202328-May-202422-Jul-202412-Aug-202421-Oct-2024       
506-Feb-202328-May-202422-Jul-202412-Aug-202421-Oct-2024       
619-Sep-202210-Oct-202202-Dec-202209-Jan-202320-Feb-2023 º¾   ¿
Sheet1
Cell Formulas
RangeFormula
G4:M6G4=FILTER(CHAR({186,190,191,192,187}),(G$2<=$B4:$F4)*(G$3>=$B4:$F4),"")
 
Upvote 0
Thats works perfectly - Thanks

Ive never come across this filter formula before could you breakdown what it is doing?

Thanks again
 
Upvote 0
Hi, check out the MS help:


It's really designed to return multiple values - In this instance we are relying on the fact the dates in columns B:F are unique across each row to return just one of CHAR()'s based on the criteria specified in the second argument.
 
Upvote 0

Forum statistics

Threads
1,215,529
Messages
6,125,344
Members
449,219
Latest member
Smiqer

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