Formula needed..Or Suggestion Pivot..

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,284
Office Version
  1. 365
Platform
  1. Windows
In Col A, I have time..
Code:
6/14/2017 6:22:23 AM
In Col B, I use Hour formula to get Hour..
Code:
=HOUR(A2)

I got the answer.."6"
...................................
Then I need AM & PM in Value..So modified formula like below..
Col C new formula
Code:
=IF(MOD(A2,1)>0.5,"PM","AM")

Col B then modified..
Code:
=HOUR(A2) &" " &C2

I got the answer.."6 AM"
---------------------------

I make a pivot of this. In pivot, dates are NOT ordered in 0 AM, 1 AM, 2 AM,....and so on..(In Row label)*2nd edit

Therefore, I do Sort AtoZ, but now values display like....0 AM, 1 AM, 10 AM, 11 AM..

Which incorrect...

Can any please guide me how do I this pivot Or any new formula which directly gives me time values correctly..
 
Last edited:

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Have you tried formatting your time as AM/PM instead of creating a text string?
 
Upvote 0
Hi, it is already in this format in Col A. what you said.
Have you tried formatting your time as AM/PM instead of creating a text string?

Actually, prev i use, only hour formula...and it is coming in pivot is ascending order only, i.e. 0, 1, 2, ....like

but i got request change now, saying that, in pivot do some trick where instead showing 0, 1, 2,...in graph...it will show as, 00 AM, 01 AM, ...13 PM, 14 Pm.. This is I want...to see in graph...
 
Upvote 0
You can format the time field as required in the PT
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

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