SOLVED

Using Excel's functions with Hijri calendar

%3CLINGO-SUB%20id%3D%22lingo-sub-3007443%22%20slang%3D%22en-US%22%3EUsing%20Excel's%20functions%20with%20Hijri%20calendar%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3007443%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20have%20an%20excel%20sheet%20where%20I'm%20using%20both%20the%20%3CSTRONG%3EHijri%3C%2FSTRONG%3E%20and%3CSTRONG%3E%20Gregorian%20calendars%3C%2FSTRONG%3E%20in%20it.%3C%2FP%3E%3CP%3EI'm%20trying%20to%20get%20the%20excel%20sheet%20to%20bring%20the%20%3CSTRONG%3Etoday's%20date%3C%2FSTRONG%3E%20and%20then%20%3CSTRONG%3Ebreak%20it%20into%20year%2C%20month%2C%20and%20day%3C%2FSTRONG%3E%20values%20separately%20in%20each%20cell.%3C%2FP%3E%3CP%3Emy%20idea%20is%20to%20use%20the%20%22%3Dtoday()%22%20formula%20to%20return%20the%20today's%20date%20and%20then%20use%20the%20functions%3A%20%22day(%20)%22%20%2C%26nbsp%3B%20%22month(%20)%22%20%2C%26nbsp%3B%20%22year%20(%20)%22.%3C%2FP%3E%3CP%3Enow%20for%20the%26nbsp%3BGregorian%20date%20it%20works%20flawlessly%2C%20but%20for%20the%20Hijri%20date%20it%20returns%20the%26nbsp%3BGregorian%20values%20even%20though%20the%20date%20is%20converted%20using%20the%20cell%20format.%20I'm%20not%20really%20sure%20about%20how%20to%20get%20the%20excel%20to%20return%20the%20Hijri%20values.%20I%20tried%20using%20the%20Left%20and%20Right%20function%20but%20it%20didn't%20work%20as%20well.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Screen%20Shot%202021-11-26%20at%208.37.04%20AM.png%22%20style%3D%22width%3A%20574px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F329630i3953856E7E8683AB%2Fimage-dimensions%2F574x216%3Fv%3Dv2%22%20width%3D%22574%22%20height%3D%22216%22%20role%3D%22button%22%20title%3D%22Screen%20Shot%202021-11-26%20at%208.37.04%20AM.png%22%20alt%3D%22Screen%20Shot%202021-11-26%20at%208.37.04%20AM.png%22%20%2F%3E%3C%2FSPAN%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3007443%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3007621%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Excel's%20functions%20with%20Hijri%20calendar%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3007621%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1230100%22%20target%3D%22_blank%22%3E%40EyadAlharbi%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20are%20many%20roads%20leading%20to%20Rome%2C%20and%20there%20are%20many%20roads%20leading%20to%20a%20solution%20in%20Excel.%3C%2FP%3E%3CP%3EYou%20could%20do%20it%20with%20cell%20formatting%2C%20too%2C%20easily%20and%20quickly.%3C%2FP%3E%3CP%3EOn%20the%20desired%20cell%20where%20the%20day%2C%20month%20or%20year%20should%20be%2C%20simply%20connect%20to%20the%20date%20cell.%3C%2FP%3E%3CP%3EExample%3A%20Click%20on%20cell%20C3%20and%20enter%20%22%3D%20A3%22%20as%20the%20formula%20(without%20quotes).%3C%2FP%3E%3CP%3EThe%20value%20(date)%20of%20cell%20A3%20appears%20in%20cell%20C3.%3C%2FP%3E%3CP%3EThen%20on%20cell%20C3%3C%2FP%3E%3CP%3Epress%20the%20right%20mouse%20button%2C%3C%2FP%3E%3CP%3EFormat%20cells%20...%20select%2C%3C%2FP%3E%3CP%3Ego%20to%20Custom%2C%3C%2FP%3E%3CP%3Efor%20type%3A%20insert%20DD%20for%20day%2C%20or%20MM%20for%20month%2C%20or%20YYYY%20for%20year.%3C%2FP%3E%3CP%3EPress%20Ok%20and%20you%20will%20only%20see%20the%20desired%20date%2C%20month%20or%20year.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%3EExamples%20with%20this%20option%20and%20with%20formulas%20can%20be%20found%20in%20the%20inserted%20example%20file.%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EHope%20I%20was%20able%20to%20help%20you%20with%20this%20info.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENikolino%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3008913%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Excel's%20functions%20with%20Hijri%20calendar%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3008913%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F722750%22%20target%3D%22_blank%22%3E%40NikolinoDE%3C%2FA%3E%26nbsp%3Bfor%20your%20response.%3C%2FP%3E%3CP%3EI%20tried%20your%20method%20but%20I'm%20still%20having%20the%20same%20issue.%20see%20the%20outputs%20in%20row%202%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%222021-11-26.png%22%20style%3D%22width%3A%20497px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F329708i8D9BDA101E1E1DEF%2Fimage-dimensions%2F497x249%3Fv%3Dv2%22%20width%3D%22497%22%20height%3D%22249%22%20role%3D%22button%22%20title%3D%222021-11-26.png%22%20alt%3D%222021-11-26.png%22%20%2F%3E%3C%2FSPAN%3EThe%20desired%2Fcorrect%20outputs%20for%20row%202%20should%20be%3A%2021%20for%20cell%20C3%2C%2004%20for%20cell%20D3%2Cand%201443%20for%20cell%20E3.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi,

I have an excel sheet where I'm using both the Hijri and Gregorian calendars in it.

I'm trying to get the excel sheet to bring the today's date and then break it into year, month, and day values separately in each cell.

my idea is to use the "=today()" formula to return the today's date and then use the functions: "day( )" ,  "month( )" ,  "year ( )".

now for the Gregorian date it works flawlessly, but for the Hijri date it returns the Gregorian values even though the date is converted using the cell format. I'm not really sure about how to get the excel to return the Hijri values. I tried using the Left and Right function but it didn't work as well. 

Screen Shot 2021-11-26 at 8.37.04 AM.png 

5 Replies

@EyadAlharbi 

There are many roads leading to Rome, and there are many roads leading to a solution in Excel.

You could do it with cell formatting, too, easily and quickly.

On the desired cell where the day, month or year should be, simply connect to the date cell.

Example: Click on cell C3 and enter "= A3" as the formula (without quotes).

The value (date) of cell A3 appears in cell C3.

Then on cell C3

press the right mouse button,

Format cells ... select,

go to Custom,

for type: insert DD for day, or MM for month, or YYYY for year.

Press Ok and you will only see the desired date, month or year.

 

Examples with this option and with formulas can be found in the inserted example file.

 

Hope I was able to help you with this info.

 

 

Nikolino

I know I don't know anything (Socrates)

 

 

 

Thank you @NikolinoDE for your response.

I tried your method but I'm still having the same issue. see the outputs in row 2

2021-11-26.pngThe desired/correct outputs for row 2 should be: 21 for cell C3, 04 for cell D3,and 1443 for cell E3.

 

Regards,

 

best response confirmed by EyadAlharbi (New Contributor)
Solution

@EyadAlharbi 

If apply correct format it shown correctly

image.png

Thank you Sergei. It worked!

@EyadAlharbi , you are welcome, glad it helped