Home > Net >  How to convert a decimal into it's time equivalent as part of a function?
How to convert a decimal into it's time equivalent as part of a function?

Time:03-26

I'm running into an issue when trying to compare data across two sheets to find discrepancies - specifically when it comes to comparing start and end times.

Right now, the "IF" statement in my screenshot is executing perfectly, except when a time is involved - it's reading those cells as decimals instead (but only sometimes).

I've tried formatting these cells (on the raw data AND on this "Discrepancies" report sheet) so that they are displayed as a "HH:MM am/pm" time, but the sheet is still comparing the decimal values.

Is there anything that I can add to this function to account for a compared value being a time instead of text, and having that text be compared for any discrepancies? I cannot add or change anything to the raw data sheets, the only thing I can edit is the formula seen in the screenshot I provided.

See the highlighted cells in my screenshot - this is the issue I keep running into. As you can see, there are SOME cells (the non-highlighted ones) that are executing as intended, but I'm unsure why this isn't the case for the whole spreadsheet when I've formatted everything the same way using the exact same formula across the whole sheet.

For example, the values in cell N2 is "8:00 AM" on both sheets, so the formula should just display "8:00 AM" in that cell (and NOT be highlighted) since there is no discrepancy in the cells between both sheets it's comparing. But instead, it's showing both times as a decimal with the slightest difference between them and is suggesting a difference where there technically isn't (or shouldn't be) one.

Please help!

enter image description here


update

delete all formulae from range B2:O10 and use this in B2:

=ARRAYFORMULA(IF(TO_TEXT(MicrositeRawData!B2:O10)=
 TO_TEXT(CleanedUpSalesforceData!B2:O10), MicrositeRawData!B2:O10,
 "MICROSITE: "&TEXT(IF(MicrositeRawData!B2:O10="", 
 "", MicrositeRawData!B2:O10), "h:mm AM/PM")&CHAR(10)&
 "SALESFORCE: "&TEXT(IF(CleanedUpSalesforceData!B2:O10="", 
 "", CleanedUpSalesforceData!B2:O10), "h:mm AM/PM")))

enter image description here

  • Related