Get the correct dates according to selected quarter and year,

danpan

New Member
Joined
Aug 27, 2020
Messages
10
Office Version
  1. 365
Platform
  1. Windows
So here goes, I have been playing around with a workbook (trying to automate it as much as possible. But I seem to be struggling with this part here.
I have a basic table where the date, salary amount and the pay period go in. Now in the date boxes as the pay date is always the last working day of the month I was trying to get it to fill it in automatically according to the year, quarter if that makes sense .Any help would be appreciated!

1598554315983.png
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
This would go in Date cell
=EOMONTH(RIGHT(payperiodcell,LEN(payperiodcell)-SEARCH("-",payperiodcell))*1,0)
 
Upvote 0
Solution
This would go in Date cell
=EOMONTH(RIGHT(payperiodcell,LEN(payperiodcell)-SEARCH("-",payperiodcell))*1,0)
Thank you thats worked, would you be able to explain the formula so I can understand how it works? t
Again thank you for your help!
 
Upvote 0
Excel will recognize the text FEB2023 as a date (2/1/2023) if entered that way in the cell. RIGHT pulls the number of characters we want from the right end of the text, LEN/SEARCH tells it how many characters to pull based on where the dash is. This returns text. By multiplying by 1 we are telling EXCEL its not meant to be text. EOMONTH takes the now found 2/1/2023 and gives the last date of the month. If you use evaluate from the formulas tab and evaluate each step it will show you what's happening.
 
Upvote 0

Forum statistics

Threads
1,214,829
Messages
6,121,827
Members
449,051
Latest member
excelquestion515

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