Date in If Else Column Subtraction

Hi,

I have a Start Date Column with a value.
If this value is before First January 2021, I need to call First January 2021 date instead.
So I used IF Else Column.

I also have End Date Column with a value.
If this value is after Today, I need to call Now date. And also, I used If Else Column.

Now, I need to calculate the days from Start Date to End Date.
I can simply subtract End Date with Start Date if its Date Column.
But now, its If Else Column. It not works if I simply subtract .
Please help.

You can use either Excel sheet formula, or glideapp

Here is how to use it in Excel:
Look at this table: A| B| C| D columns.

Start Date End Date Cut_of_Date Today
9/2/2021 10/2/2021 1/1/2021 9/21/2021
9/2/2019 10/10/2019 1/1/2021 9/21/2021

To get:

If_Col_1 if_Col_2
9/2/2021 9/21/2021
1/1/2021 10/10/2019

If_Col_1 Use: =if(A2<C2,C2,A2) in D column

if_Col_2 use: =if(B2>D2,D2,B2) in F column

i need to do in glideapps .

it something like this.

Hi Nadir,

Thanks for your response, but i need the total number of days from start date to end date.
Do you have any ideas?

If in Excel, it is something like down below, but how to do in Glideapps:

image

In F2 the formula = =IF(A2<C2,C2,A2)
In F3 the formula = =IF(A3<C3,C3,A3)

In G2 the formula = =IF(B2>D2,D2,B2)
In G3 the formula = =IF(B3>D3,D3,B3)

And To get the answer :

image

the formula for K2 = =G2-F2
the formula for K3 = =G3-F3

Sorry, I just read this very quickly, but… do you just want the total number of days between two dates?

If yes, this is a very simple subtraction in a Glide math column: End Date - Start Date
As long as both columns are date/time columns, then that will give you the difference in days.

Yes, you correct.
But I have the date column in IF Else Column…

What does the if-then-else look like?

It is something like this:

Okay, and what do you get when you try to use that in the calculation?

It is empty

It is work when use the Date Column , but i really need to use If else column

Works for me…

Your “Jan 1st 2021” column - did you create that in Glide or in a Google sheet?
Check and make sure it’s configured as a date/time column in Glide.
It looks like it is, but I have found that if you create date/time columns in Google Sheets, you need to edit the column in Glide and apply the correct column type.

I create in Glide straightway .

Okay, well as I said - I tried it and it seems to work fine, so not sure what’s going on in your case.

Hm I’ve check the format in Glide. Seems like the same. hmm no idea.

it turn up like this “invalid operation on date/time”

@Darren_Murphy

Darren,

Please help. Do you have any idea why I still cannot subtract that two things.
Today, I’ve tried using same conditions but in different sheet. But still cannot.
Do you have any idea why ?

image

image

image

image

if else column will turn date to a text… so math will not work… i will suggest to do another math on these if else to convert back to date

But Darren did well.

is all about initial formatting… so i cant help you without actually seeing the app from inside… but don’ do that… lol i’m not in to grinding now… LOL…
try to convert dates to numbers…